Skip to content

Instantly share code, notes, and snippets.

@lawreyios
Last active April 7, 2019 13:27
Show Gist options
  • Save lawreyios/ca8882245390facd74eb04421c7e3202 to your computer and use it in GitHub Desktop.
Save lawreyios/ca8882245390facd74eb04421c7e3202 to your computer and use it in GitHub Desktop.
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