diff --git a/lib/main.dart b/lib/main.dart index 6b7f983..2eb1255 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,16 +35,30 @@ class MyHomePage extends StatelessWidget { style: TextStyle(color: Theme.of(context).accentColor)), shadowColor: const Color(0x00000000), actions: [ - 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, ) ], ), diff --git a/lib/route.dart b/lib/route.dart index 41920c5..0cd1ec8 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -50,3 +50,52 @@ class _SecondRouteState extends State { ); } } + +class CursState extends StatefulWidget { + @override + _CursRouteState createState() => _CursRouteState(); +} + +class _CursRouteState extends State { + @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(context, listen: false) + .toggleTheme(); + }, + ), + ) + ], + ), + )), + ); + } +}