Skip to content

Instantly share code, notes, and snippets.

@shihaohong
Created August 25, 2019 23:32
Show Gist options
  • Save shihaohong/afb796953e11e53038a51c087c9cbe3f to your computer and use it in GitHub Desktop.
Save shihaohong/afb796953e11e53038a51c087c9cbe3f to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: Drawer(),
appBar: AppBar(
title: Text("Shop name"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.search),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.favorite),
onPressed: () {
Navigator.of(context).push(
PageRouteBuilder(
pageBuilder: (BuildContext context, _, __) {
return Scaffold(
appBar: AppBar(
title: Text("Route 1"),
),
);
},
),
);
},
),
IconButton(
icon: Icon(Icons.person),
onPressed: () {
Navigator.of(context).push(
PageRouteBuilder(
pageBuilder: (BuildContext context, _, __) {
return Scaffold(
appBar: AppBar(
title: Text("Route 2"),
),
);
},
),
);
},
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment