-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Remi Rousselet
committed
Feb 23, 2020
1 parent
464ff6d
commit cbb2f28
Showing
7 changed files
with
95 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_portal/flutter_portal.dart'; | ||
|
||
void main() { | ||
runApp(MyApp()); | ||
} | ||
|
||
class MyApp extends StatefulWidget { | ||
@override | ||
_MyAppState createState() => _MyAppState(); | ||
} | ||
|
||
class _MyAppState extends State<MyApp> { | ||
final notifier = ValueNotifier<Widget>(const Text('first')); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
Future.microtask(() { | ||
notifier.value = PortalEntry( | ||
portal: const Text('overlay'), | ||
child: const Text('second'), | ||
); | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final builder = ValueListenableBuilder<Widget>( | ||
valueListenable: notifier, | ||
builder: (_, child, __) => child, | ||
); | ||
return Boilerplate( | ||
child: Portal( | ||
child: Center(child: builder), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class Boilerplate extends StatelessWidget { | ||
final Widget child; | ||
|
||
const Boilerplate({Key key, this.child}) : super(key: key); | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
body: child, | ||
), | ||
); | ||
} | ||
} |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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