new settign button
This commit is contained in:
parent
45803c6519
commit
b5b1be28e0
@ -35,16 +35,30 @@ class MyHomePage extends StatelessWidget {
|
||||
style: TextStyle(color: Theme.of(context).accentColor)),
|
||||
shadowColor: const Color(0x00000000),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings),
|
||||
tooltip: 'Show Snackbar',
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SecondRoute()),
|
||||
);
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) => [
|
||||
const PopupMenuItem(
|
||||
value: 1,
|
||||
child: Text("Настройки темы"),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 2,
|
||||
child: Text("Курс валют"),
|
||||
),
|
||||
],
|
||||
onSelected: (value) {
|
||||
if (value == 1) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SecondRoute()),
|
||||
);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => CursState()),
|
||||
);
|
||||
}
|
||||
},
|
||||
color: Theme.of(context).accentColor,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@ -50,3 +50,52 @@ class _SecondRouteState extends State<SecondRoute> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CursState extends StatefulWidget {
|
||||
@override
|
||||
_CursRouteState createState() => _CursRouteState();
|
||||
}
|
||||
|
||||
class _CursRouteState extends State<CursState> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Курсы валют в рублях",
|
||||
style: TextStyle(color: Theme.of(context).accentColor)),
|
||||
shadowColor: const Color(0x00000000),
|
||||
),
|
||||
body: Container(
|
||||
color: Theme.of(context).primaryColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(8),
|
||||
children: [
|
||||
ListTile(
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.settings_display,
|
||||
color: Theme.of(context).accentColor,
|
||||
),
|
||||
onPressed: null),
|
||||
title: Text(
|
||||
"Светлая тема",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).accentColor),
|
||||
),
|
||||
trailing: Switch(
|
||||
value: Theme.of(context).brightness == Brightness.light,
|
||||
onChanged: (value) {
|
||||
Provider.of<ThemeModel>(context, listen: false)
|
||||
.toggleTheme();
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user