1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Clean up ng-flutter a bit (#2236)

No functional change, just while I was verifying it still works with the
latest Angular releases, completed some cleanup as well.
This commit is contained in:
Parker Lougheed
2024-04-08 16:22:25 -05:00
committed by GitHub
parent 37e149d8a6
commit 6b8f18392d
10 changed files with 97 additions and 103 deletions

View File

@@ -1,4 +1,4 @@
// ignore_for_file: avoid_web_libraries_in_flutter
import 'dart:js_interop' show createJSInteropWrapper;
import 'package:flutter/material.dart';
@@ -25,16 +25,15 @@ class _MyAppState extends State<MyApp> {
final ValueNotifier<int> _counter = ValueNotifier<int>(0);
final ValueNotifier<String> _text = ValueNotifier<String>('');
late final DemoAppStateManager _state;
late final DemoAppStateManager _state = DemoAppStateManager(
screen: _screen,
counter: _counter,
text: _text,
);
@override
void initState() {
super.initState();
_state = DemoAppStateManager(
screen: _screen,
counter: _counter,
text: _text,
);
final export = createJSInteropWrapper(_state);
// Emit this through the root object of the flutter app :)
@@ -60,14 +59,9 @@ class _MyAppState extends State<MyApp> {
);
}
Widget demoScreenRouter(DemoScreen which) {
switch (which) {
case DemoScreen.counter:
return CounterDemo(counter: _counter);
case DemoScreen.text:
return TextFieldDemo(text: _text);
case DemoScreen.dash:
return DashDemo(text: _text);
}
}
Widget demoScreenRouter(DemoScreen which) => switch (which) {
DemoScreen.counter => CounterDemo(counter: _counter),
DemoScreen.text => TextFieldDemo(text: _text),
DemoScreen.dash => DashDemo(text: _text)
};
}