Skip to content

Commit

Permalink
Switch Flutter to dev channel
Browse files Browse the repository at this point in the history
  • Loading branch information
FeodorFitsner committed Aug 2, 2022
1 parent d9e3fc6 commit c3273c1
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ for:
install:
- ps: .\ci\install_flutter.ps1
- set PATH=C:\flutter\bin;%PATH%
- flutter channel master
- flutter channel dev
- flutter upgrade

build_script:
Expand Down Expand Up @@ -139,7 +139,7 @@ for:
- curl https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.0.3-stable.zip -o flutter_macos_stable.zip
- unzip -qq flutter_macos_stable.zip
- export PATH="$PATH:`pwd`/flutter/bin"
- flutter channel master
- flutter channel dev
- flutter upgrade
- flutter config --enable-macos-desktop
- flutter doctor
Expand Down Expand Up @@ -174,7 +174,7 @@ for:
install:
# Flutter SDK
- sudo snap install flutter --classic
- flutter channel master
- flutter channel dev
- flutter upgrade
- flutter sdk-path

Expand Down Expand Up @@ -210,7 +210,7 @@ for:
- curl https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.0.3-stable.zip -o flutter_macos_stable.zip
- unzip -qq flutter_macos_stable.zip
- export PATH="$PATH:`pwd`/flutter/bin"
- flutter channel master
- flutter channel dev
- flutter upgrade
- flutter doctor

Expand Down Expand Up @@ -253,7 +253,7 @@ for:
install:
# Flutter SDK
- sudo snap install flutter --classic
- flutter channel master
- flutter channel dev
- flutter upgrade
- flutter sdk-path

Expand Down
3 changes: 1 addition & 2 deletions client/lib/controls/alert_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class _AlertDialogControlState extends State<AlertDialogControl> {
actions: actionCtrls
.map((c) => createControl(widget.control, c.id, disabled))
.toList(),
actionsPadding:
parseEdgeInsets(widget.control, "actionsPadding") ?? EdgeInsets.zero,
actionsPadding: parseEdgeInsets(widget.control, "actionsPadding"),
actionsAlignment: actionsAlignment,
);
}
Expand Down
4 changes: 2 additions & 2 deletions client/lib/controls/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ class _PageControlState extends State<PageControl> {
// fontFamily: kIsWeb && window.navigator.userAgent.contains('OS 15_')
// ? '-apple-system'
// : null,
visualDensity: VisualDensity.adaptivePlatformDensity);
visualDensity: VisualDensity.standard);

var darkTheme = parseTheme(widget.control, "darkTheme") ??
ThemeData(
colorSchemeSeed: Colors.blue,
brightness: Brightness.dark,
useMaterial3: true,
visualDensity: VisualDensity.adaptivePlatformDensity);
visualDensity: VisualDensity.standard);

var themeMode = ThemeMode.values.firstWhere(
(t) =>
Expand Down
22 changes: 21 additions & 1 deletion client/lib/utils/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,25 @@ ThemeData themeFromJson(Map<String, dynamic> json) {
colorSchemeSeed:
HexColor.fromString(null, json["color_scheme_seed"] ?? ""),
fontFamily: json["font_family"],
useMaterial3: json["use_material3"]);
useMaterial3: json["use_material3"],
visualDensity: parseVisualDensity(json["visual_density"]));
}

VisualDensity? parseVisualDensity(String? vd) {
if (vd == null) {
return null;
}

switch (vd.toLowerCase()) {
case "adaptiveplatformdensity":
return VisualDensity.adaptivePlatformDensity;
case "comfortable":
return VisualDensity.comfortable;
case "compact":
return VisualDensity.compact;
case "standard":
return VisualDensity.standard;
default:
return null;
}
}
2 changes: 1 addition & 1 deletion client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.1"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand Down
14 changes: 7 additions & 7 deletions sdk/python/flet/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def clean(self):
return self.__page._send_command("clean", [self.uid])

def build_update_commands(self, index, added_controls, commands, isolated=False):
update_cmd = self._get_cmd_attrs(update=True)
update_cmd = self._build_command(update=True)

if len(update_cmd.attrs) > 0:
update_cmd.name = "set"
Expand Down Expand Up @@ -333,7 +333,7 @@ def build_update_commands(self, index, added_controls, commands, isolated=False)
for h in current_ints[b1:b2]:
# add
ctrl = hashes[h]
innerCmds = ctrl.get_cmd_str(
innerCmds = ctrl._build_add_commands(
index=index, added_controls=added_controls
)
commands.append(
Expand All @@ -350,7 +350,7 @@ def build_update_commands(self, index, added_controls, commands, isolated=False)
# add
for h in current_ints[b1:b2]:
ctrl = hashes[h]
innerCmds = ctrl.get_cmd_str(
innerCmds = ctrl._build_add_commands(
index=index, added_controls=added_controls
)
commands.append(
Expand All @@ -376,7 +376,7 @@ def _remove_control_recursively(self, index, control):
del index[control.__uid]

# private methods
def get_cmd_str(self, indent=0, index=None, added_controls=None):
def _build_add_commands(self, indent=0, index=None, added_controls=None):

self._build()

Expand All @@ -387,7 +387,7 @@ def get_cmd_str(self, indent=0, index=None, added_controls=None):
commands = []

# main command
command = self._get_cmd_attrs(False)
command = self._build_command(False)
command.indent = indent
command.values.append(self._get_control_name())
commands.append(command)
Expand All @@ -398,7 +398,7 @@ def get_cmd_str(self, indent=0, index=None, added_controls=None):
# controls
children = self._get_children()
for control in children:
childCmd = control.get_cmd_str(
childCmd = control._build_add_commands(
indent=indent + 2, index=index, added_controls=added_controls
)
commands.extend(childCmd)
Expand All @@ -408,7 +408,7 @@ def get_cmd_str(self, indent=0, index=None, added_controls=None):

return commands

def _get_cmd_attrs(self, update=False):
def _build_command(self, update=False):
command = Command(0, None, [], {}, [])

if update and not self.__uid:
Expand Down
7 changes: 6 additions & 1 deletion sdk/python/flet/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
except:
from typing_extensions import Literal

VisualDensity = Literal[
None, "standard", "compact", "comfortable", "adaptivePlatformDensity"
]


@dataclasses.dataclass
class Theme:
color_scheme_seed: str = field(default=None)
brightness: Literal[None, "dark", "light"] = field(default="light")
font_family: str = field(default=None)
use_material3: bool = field(default=False)
use_material3: bool = field(default=True)
visual_density: VisualDensity = field(default="standard")
2 changes: 1 addition & 1 deletion sdk/python/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_image_add():
)
assert isinstance(i, flet.Control)
assert isinstance(i, flet.Image)
assert i.get_cmd_str() == [
assert i._build_add_command() == [
Command(
indent=0,
name=None,
Expand Down

0 comments on commit c3273c1

Please sign in to comment.