Created
October 20, 2019 16:12
-
-
Save miquelbeltran/eda65c6e97e529584a11898c868c3751 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Let's do a Hello World |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter_web/material.dart'; | |
| import 'package:flutter_web_test/flutter_web_test.dart'; | |
| import 'package:flutter_web_ui/ui.dart' as ui; | |
| class MyWidget extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Container(); | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter_web/material.dart'; | |
| import 'package:flutter_web_test/flutter_web_test.dart'; | |
| import 'package:flutter_web_ui/ui.dart' as ui; | |
| class MyWidget extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Text('Hello World'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Directionality( | |
| textDirection: TextDirection.ltr, | |
| child: Container( | |
| color: Color(0xffeeeeee), | |
| child: Center( | |
| child: Container( | |
| child: MyWidget(), | |
| color: Color(0xffcccccc), | |
| ), | |
| ), | |
| ), | |
| ); | |
| } | |
| } | |
| Future<void> main() async { | |
| await ui.webOnlyInitializePlatform(); | |
| runApp(MyApp()); | |
| final controller = LiveWidgetController(WidgetsBinding.instance); | |
| final texts = controller.widgetList(find.byType(Text)); | |
| if (texts.length == 0) { | |
| _result(false, ['Couldn\'t find a Text!']); | |
| return; | |
| } | |
| if (texts.length > 1) { | |
| _result(false, ['Found ${texts.length} Text, rather than just one.']); | |
| return; | |
| } | |
| final text = texts.first as Text; | |
| if (text.data != 'Hello World') { | |
| _result(false, ['The Text does not say Hello World.']); | |
| return; | |
| } | |
| _result(true, ['A Text that says "Hello World". Well done!']); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment