Last active
April 7, 2019 13:27
-
-
Save lawreyios/ca8882245390facd74eb04421c7e3202 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
import 'package:flutter/material.dart'; | |
import 'package:scoped_model/scoped_model.dart'; | |
import 'package:flutter_global_variable/scoped_models/main.dart'; | |
import 'package:flutter_global_variable/pages/page3.dart'; | |
class Page2 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.white, | |
appBar: AppBar( | |
title: Text("Page 2"), | |
backgroundColor: Colors.transparent, | |
elevation: 0.0), | |
body: ScopedModelDescendant<MainModel>( | |
builder: (BuildContext context, Widget child, MainModel model) { | |
return Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'Your counter value is: ${model.count}', | |
style: TextStyle(fontSize: 18.0), | |
), | |
RaisedButton( | |
padding: const EdgeInsets.all(8.0), | |
child: Text('Confirm'), | |
onPressed: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute<Page3>( | |
builder: (BuildContext context) => Page3()), | |
); | |
}) | |
], | |
), | |
); | |
}), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment