Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9f07c63ef |
13
.vscode/launch.json
vendored
Normal file
13
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "cloudtech_calculator",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart';
|
|||||||
import 'package:cloudtech_calculator/theme_model.dart';
|
import 'package:cloudtech_calculator/theme_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'route.dart';
|
||||||
|
|
||||||
enum Operation {
|
enum Operation {
|
||||||
plus,
|
plus,
|
||||||
@ -256,7 +257,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
tooltip: 'Show Snackbar',
|
tooltip: 'Show Snackbar',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Provider.of<ThemeModel>(context, listen: false).toggleTheme();
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => SecondRoute()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
color: Theme.of(context).accentColor,
|
color: Theme.of(context).accentColor,
|
||||||
)
|
)
|
||||||
|
|||||||
52
lib/route.dart
Normal file
52
lib/route.dart
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import 'package:cloudtech_calculator/theme_model.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class SecondRoute extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_SecondRouteState createState() => _SecondRouteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SecondRouteState extends State<SecondRoute> {
|
||||||
|
@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();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
ThemeData darkTheme = ThemeData.dark().copyWith(
|
ThemeData darkTheme = ThemeData(
|
||||||
primaryColor: const Color(0xff131618),
|
primaryColor: const Color(0xff131618),
|
||||||
accentColor: Colors.white,
|
accentColor: Colors.white,
|
||||||
|
brightness: Brightness.dark,
|
||||||
textTheme: const TextTheme(bodyText2: TextStyle(color: Color(0xffffffff))),
|
textTheme: const TextTheme(bodyText2: TextStyle(color: Color(0xffffffff))),
|
||||||
);
|
);
|
||||||
|
|
||||||
ThemeData lightTheme = ThemeData.light().copyWith(
|
ThemeData lightTheme = ThemeData(
|
||||||
primaryColor: Colors.white,
|
primaryColor: Colors.white,
|
||||||
accentColor: Colors.green,
|
accentColor: Colors.green,
|
||||||
|
brightness: Brightness.light,
|
||||||
textTheme: const TextTheme(bodyText2: TextStyle(color: Colors.green)),
|
textTheme: const TextTheme(bodyText2: TextStyle(color: Colors.green)),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user