Skip to content

Commit

Permalink
Page.design property (#2607)
Browse files Browse the repository at this point in the history
* Introduced page.design, added adaptive to some controls

* parseCupertinoTheme()

* Page.design complete

* Pagelet.design

* Fix page theme

* Cleanup

* Use CupertinoApp and figured out theme overrides

* `page.media` property and `page.on_media_change` event (#2613)

* `page.media` property and `page.on_media_change` event

* Cleanup

* Replace `PageMediaInsetsData` with `Padding`

* Updated changelog for 0.20.0
  • Loading branch information
FeodorFitsner committed Feb 13, 2024
1 parent fe1a4d1 commit 24b8004
Show file tree
Hide file tree
Showing 33 changed files with 672 additions and 308 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# 0.20.0

* `Page.design` property to force Material, Cupertino or Adaptive design language on entire app ([#2607](https://github.com/flet-dev/flet/issues/2607)).
* `Page.media` property with the data about obstructed spaces on the device ([#2613](https://github.com/flet-dev/flet/issues/2613)).
* Adaptive buttons ([#2591](https://github.com/flet-dev/flet/issues/2591)).
* `--include-packages` option and support for `pubspec.yaml` for custom Flutter packages plus API for adding custom Flutter packages.
* Add `rtl` property to multiple controls ([#2582](https://github.com/flet-dev/flet/issues/2582)).
* Fix: Material icon is shown instead of Cupertino icon if its name is thesame ([#2581](https://github.com/flet-dev/flet/issues/2581)).
Expand Down
8 changes: 4 additions & 4 deletions client/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ SPEC CHECKSUMS:
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
record_darwin: 1f6619f2abac4d1ca91d3eeab038c980d76f1517
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
sensors_plus: 42b9de1b8237675fa8d8121e4bb93be0f79fa61d
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
3 changes: 3 additions & 0 deletions packages/flet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 0.20.0

* `Page.design` property to force Material, Cupertino or Adaptive design language on entire app ([#2607](https://github.com/flet-dev/flet/issues/2607)).
* `Page.media` property with the data about obstructed spaces on the device ([#2613](https://github.com/flet-dev/flet/issues/2613)).
* Adaptive buttons ([#2591](https://github.com/flet-dev/flet/issues/2591)).
* `--include-packages` option and support for `pubspec.yaml` for custom Flutter packages plus API for adding custom Flutter packages.
* Add `rtl` property to multiple controls ([#2582](https://github.com/flet-dev/flet/issues/2582)).
* Fix: Material icon is shown instead of Cupertino icon if its name is thesame ([#2581](https://github.com/flet-dev/flet/issues/2581)).
Expand Down
7 changes: 7 additions & 0 deletions packages/flet/lib/src/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'protocol/append_control_props_request.dart';
import 'protocol/clean_control_payload.dart';
import 'protocol/invoke_method_payload.dart';
import 'protocol/page_controls_batch_payload.dart';
import 'protocol/page_media_data.dart';
import 'protocol/register_webclient_response.dart';
import 'protocol/remove_control_payload.dart';
import 'protocol/replace_page_controls_payload.dart';
Expand Down Expand Up @@ -55,6 +56,12 @@ class PageBrightnessChangeAction {
PageBrightnessChangeAction(this.brightness, this.backend);
}

class PageMediaChangeAction {
final PageMediaData media;
final FletControlBackend backend;
PageMediaChangeAction(this.media, this.backend);
}

class RegisterWebClientAction {
final RegisterWebClientResponse payload;
final FletControlBackend backend;
Expand Down
4 changes: 1 addition & 3 deletions packages/flet/lib/src/controls/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class AppBarControl extends StatelessWidget
control: control,
parentDisabled: parentDisabled,
parentAdaptive: adaptive,
children: children,
bgcolor: HexColor.fromString(
Theme.of(context), control.attrString("bgcolor", "")!));
children: children);
}

var leadingCtrls =
Expand Down
1 change: 1 addition & 0 deletions packages/flet/lib/src/controls/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class _CheckboxControlState extends State<CheckboxControl> with FletStoreMixin {
return withPagePlatform((context, platform) {
bool? adaptive =
widget.control.attrBool("adaptive") ?? widget.parentAdaptive;

if (adaptive == true &&
(platform == TargetPlatform.iOS ||
platform == TargetPlatform.macOS)) {
Expand Down
1 change: 1 addition & 0 deletions packages/flet/lib/src/controls/column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class ColumnControl extends StatelessWidget {
control: control,
scrollDirection: wrap ? Axis.horizontal : Axis.vertical,
backend: backend,
parentAdaptive: adaptive,
child: child,
);

Expand Down
12 changes: 6 additions & 6 deletions packages/flet/lib/src/controls/cupertino_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ class CupertinoAppBarControl extends StatelessWidget
final bool parentDisabled;
final bool? parentAdaptive;
final List<Control> children;
final Color? bgcolor;

const CupertinoAppBarControl(
{super.key,
this.parent,
required this.control,
required this.children,
required this.parentDisabled,
required this.parentAdaptive,
required this.bgcolor});
required this.parentAdaptive});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -79,9 +77,11 @@ class CupertinoAppBarControl extends StatelessWidget

@override
bool shouldFullyObstruct(BuildContext context) {
final Color backgroundColor =
CupertinoDynamicColor.maybeResolve(bgcolor, context) ??
CupertinoTheme.of(context).barBackgroundColor;
final Color backgroundColor = CupertinoDynamicColor.maybeResolve(
HexColor.fromString(
Theme.of(context), control.attrString("bgcolor", "")!),
context) ??
CupertinoTheme.of(context).barBackgroundColor;
return backgroundColor.alpha == 0xFF;
}
}
1 change: 1 addition & 0 deletions packages/flet/lib/src/controls/grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class _GridViewControlState extends State<GridViewControl> {
scrollDirection: horizontal ? Axis.horizontal : Axis.vertical,
scrollController: _controller,
backend: widget.backend,
parentAdaptive: adaptive,
child: child);

if (widget.control.attrBool("onScroll", false)!) {
Expand Down
1 change: 1 addition & 0 deletions packages/flet/lib/src/controls/list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class _ListViewControlState extends State<ListViewControl> {
scrollDirection: horizontal ? Axis.horizontal : Axis.vertical,
scrollController: _controller,
backend: widget.backend,
parentAdaptive: adaptive,
child: child);

if (widget.control.attrBool("onScroll", false)!) {
Expand Down

0 comments on commit 24b8004

Please sign in to comment.