Skip to content

Commit 24b8004

Browse files
Page.design property (#2607)
* 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
1 parent fe1a4d1 commit 24b8004

33 files changed

+672
-308
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# 0.20.0
44

5+
* `Page.design` property to force Material, Cupertino or Adaptive design language on entire app ([#2607](https://github.com/flet-dev/flet/issues/2607)).
6+
* `Page.media` property with the data about obstructed spaces on the device ([#2613](https://github.com/flet-dev/flet/issues/2613)).
7+
* Adaptive buttons ([#2591](https://github.com/flet-dev/flet/issues/2591)).
58
* `--include-packages` option and support for `pubspec.yaml` for custom Flutter packages plus API for adding custom Flutter packages.
69
* Add `rtl` property to multiple controls ([#2582](https://github.com/flet-dev/flet/issues/2582)).
710
* Fix: Material icon is shown instead of Cupertino icon if its name is thesame ([#2581](https://github.com/flet-dev/flet/issues/2581)).

client/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ SPEC CHECKSUMS:
145145
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
146146
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
147147
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
148-
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
148+
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
149149
record_darwin: 1f6619f2abac4d1ca91d3eeab038c980d76f1517
150150
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
151151
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
152152
sensors_plus: 42b9de1b8237675fa8d8121e4bb93be0f79fa61d
153-
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
153+
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
154154
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
155-
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
155+
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
156156
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
157157
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
158-
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
158+
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
159159

160160
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
161161

packages/flet/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 0.20.0
22

3+
* `Page.design` property to force Material, Cupertino or Adaptive design language on entire app ([#2607](https://github.com/flet-dev/flet/issues/2607)).
4+
* `Page.media` property with the data about obstructed spaces on the device ([#2613](https://github.com/flet-dev/flet/issues/2613)).
5+
* Adaptive buttons ([#2591](https://github.com/flet-dev/flet/issues/2591)).
36
* `--include-packages` option and support for `pubspec.yaml` for custom Flutter packages plus API for adding custom Flutter packages.
47
* Add `rtl` property to multiple controls ([#2582](https://github.com/flet-dev/flet/issues/2582)).
58
* Fix: Material icon is shown instead of Cupertino icon if its name is thesame ([#2581](https://github.com/flet-dev/flet/issues/2581)).

packages/flet/lib/src/actions.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'protocol/append_control_props_request.dart';
1010
import 'protocol/clean_control_payload.dart';
1111
import 'protocol/invoke_method_payload.dart';
1212
import 'protocol/page_controls_batch_payload.dart';
13+
import 'protocol/page_media_data.dart';
1314
import 'protocol/register_webclient_response.dart';
1415
import 'protocol/remove_control_payload.dart';
1516
import 'protocol/replace_page_controls_payload.dart';
@@ -55,6 +56,12 @@ class PageBrightnessChangeAction {
5556
PageBrightnessChangeAction(this.brightness, this.backend);
5657
}
5758

59+
class PageMediaChangeAction {
60+
final PageMediaData media;
61+
final FletControlBackend backend;
62+
PageMediaChangeAction(this.media, this.backend);
63+
}
64+
5865
class RegisterWebClientAction {
5966
final RegisterWebClientResponse payload;
6067
final FletControlBackend backend;

packages/flet/lib/src/controls/app_bar.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class AppBarControl extends StatelessWidget
3838
control: control,
3939
parentDisabled: parentDisabled,
4040
parentAdaptive: adaptive,
41-
children: children,
42-
bgcolor: HexColor.fromString(
43-
Theme.of(context), control.attrString("bgcolor", "")!));
41+
children: children);
4442
}
4543

4644
var leadingCtrls =

packages/flet/lib/src/controls/checkbox.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class _CheckboxControlState extends State<CheckboxControl> with FletStoreMixin {
7979
return withPagePlatform((context, platform) {
8080
bool? adaptive =
8181
widget.control.attrBool("adaptive") ?? widget.parentAdaptive;
82+
8283
if (adaptive == true &&
8384
(platform == TargetPlatform.iOS ||
8485
platform == TargetPlatform.macOS)) {

packages/flet/lib/src/controls/column.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class ColumnControl extends StatelessWidget {
7979
control: control,
8080
scrollDirection: wrap ? Axis.horizontal : Axis.vertical,
8181
backend: backend,
82+
parentAdaptive: adaptive,
8283
child: child,
8384
);
8485

packages/flet/lib/src/controls/cupertino_app_bar.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ class CupertinoAppBarControl extends StatelessWidget
1414
final bool parentDisabled;
1515
final bool? parentAdaptive;
1616
final List<Control> children;
17-
final Color? bgcolor;
1817

1918
const CupertinoAppBarControl(
2019
{super.key,
2120
this.parent,
2221
required this.control,
2322
required this.children,
2423
required this.parentDisabled,
25-
required this.parentAdaptive,
26-
required this.bgcolor});
24+
required this.parentAdaptive});
2725

2826
@override
2927
Widget build(BuildContext context) {
@@ -79,9 +77,11 @@ class CupertinoAppBarControl extends StatelessWidget
7977

8078
@override
8179
bool shouldFullyObstruct(BuildContext context) {
82-
final Color backgroundColor =
83-
CupertinoDynamicColor.maybeResolve(bgcolor, context) ??
84-
CupertinoTheme.of(context).barBackgroundColor;
80+
final Color backgroundColor = CupertinoDynamicColor.maybeResolve(
81+
HexColor.fromString(
82+
Theme.of(context), control.attrString("bgcolor", "")!),
83+
context) ??
84+
CupertinoTheme.of(context).barBackgroundColor;
8585
return backgroundColor.alpha == 0xFF;
8686
}
8787
}

packages/flet/lib/src/controls/grid_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class _GridViewControlState extends State<GridViewControl> {
107107
scrollDirection: horizontal ? Axis.horizontal : Axis.vertical,
108108
scrollController: _controller,
109109
backend: widget.backend,
110+
parentAdaptive: adaptive,
110111
child: child);
111112

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

packages/flet/lib/src/controls/list_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class _ListViewControlState extends State<ListViewControl> {
125125
scrollDirection: horizontal ? Axis.horizontal : Axis.vertical,
126126
scrollController: _controller,
127127
backend: widget.backend,
128+
parentAdaptive: adaptive,
128129
child: child);
129130

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

0 commit comments

Comments
 (0)