Skip to content

Commit 36eea30

Browse files
Navigation and Routing (#95)
* Page inherits View * Something almost working... * RouteViewModel added * Loading route * Navigator 2.0 half-integrated * Navigation 2.0 - almost done * Routes to list * Almost! * Registering web client from a route change * Fixed layout issues * Fix #87 * Fade transition for the first page * View class improved * strongly-typed on_view_pop event * TemplateRoute class added * Create page-views.drawio * Fade transition only one time * Disable logging in production
1 parent 705bf0f commit 36eea30

35 files changed

+958
-361
lines changed

client/lib/actions.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class PageSizeChangeAction {
2929
PageSizeChangeAction(this.newPageSize);
3030
}
3131

32+
class SetPageRouteAction {
33+
final String route;
34+
SetPageRouteAction(this.route);
35+
}
36+
3237
class WindowEventAction {
3338
final String eventName;
3439
final WindowMediaData wmd;

client/lib/controls/app_bar.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ class AppBarControl extends StatelessWidget implements PreferredSizeWidget {
1010
final bool parentDisabled;
1111
final List<Control> children;
1212
final double height;
13-
final ThemeData theme;
1413

1514
const AppBarControl(
1615
{Key? key,
1716
this.parent,
1817
required this.control,
1918
required this.children,
2019
required this.parentDisabled,
21-
required this.height,
22-
required this.theme})
20+
required this.height})
2321
: super(key: key);
2422

2523
@override
@@ -34,9 +32,10 @@ class AppBarControl extends StatelessWidget implements PreferredSizeWidget {
3432
var leadingWidth = control.attrDouble("leadingWidth");
3533
var elevation = control.attrDouble("elevation");
3634
var centerTitle = control.attrBool("centerTitle", false)!;
37-
var color = HexColor.fromString(theme, control.attrString("color", "")!);
38-
var bgcolor =
39-
HexColor.fromString(theme, control.attrString("bgcolor", "")!);
35+
var color = HexColor.fromString(
36+
Theme.of(context), control.attrString("color", "")!);
37+
var bgcolor = HexColor.fromString(
38+
Theme.of(context), control.attrString("bgcolor", "")!);
4039

4140
return AppBar(
4241
leading: leadingCtrls.isNotEmpty

client/lib/controls/create_control.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ Widget createControl(Control? parent, String id, bool parentDisabled) {
6464
switch (controlView.control.type) {
6565
case ControlType.page:
6666
return PageControl(
67-
control: controlView.control, children: controlView.children);
67+
control: controlView.control,
68+
children: controlView.children,
69+
dispatch: controlView.dispatch);
6870
case ControlType.text:
6971
return TextControl(control: controlView.control);
7072
case ControlType.icon:
@@ -332,9 +334,10 @@ Widget _sizedControl(Widget widget, Control? parent, Control control) {
332334

333335
Widget _expandable(Widget widget, Control? parent, Control control) {
334336
if (parent != null &&
335-
(parent.type == ControlType.page ||
337+
(parent.type == ControlType.view ||
336338
parent.type == ControlType.column ||
337339
parent.type == ControlType.row)) {
340+
debugPrint("Expandable ${control.id}");
338341
int? expand = control.attrInt("expand");
339342
return expand != null ? Expanded(child: widget, flex: expand) : widget;
340343
}

client/lib/controls/floating_action_button.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ class FloatingActionButtonControl extends StatelessWidget {
6060
child: Icon(icon),
6161
backgroundColor: bgColor,
6262
);
63+
} else if (icon == null && text != null) {
64+
button = FloatingActionButton(
65+
autofocus: autofocus,
66+
onPressed: onPressed,
67+
child: Text(text),
68+
backgroundColor: bgColor,
69+
);
6370
} else if (icon != null && text != null) {
6471
button = FloatingActionButton.extended(
6572
autofocus: autofocus,

0 commit comments

Comments
 (0)