add switch for theme toggle
This commit is contained in:
parent
6ea2c0e195
commit
ec95293ff8
3 changed files with 27 additions and 1 deletions
|
@ -16,7 +16,7 @@ final lightThemeData = ThemeData(
|
|||
hintColor: Colors.grey,
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
primaryIconTheme: IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),
|
||||
colorScheme: ColorScheme.light(primary: Colors.blue),
|
||||
colorScheme: ColorScheme.light(primary: Colors.black),
|
||||
accentColor: Color.fromRGBO(45, 194, 98, 0.2),
|
||||
buttonColor: Color.fromRGBO(45, 194, 98, 1.0),
|
||||
buttonTheme: ButtonThemeData().copyWith(
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class ThemeSwitchWidget extends StatelessWidget {
|
||||
const ThemeSwitchWidget({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Switch(
|
||||
value: true,
|
||||
activeColor: Colors.black,
|
||||
onChanged: (bool value) {
|
||||
print(value);
|
||||
},
|
||||
activeThumbImage: new NetworkImage(
|
||||
'https://cdn0.iconfinder.com/data/icons/multimedia-solid-30px/30/moon_dark_mode_night-512.png'),
|
||||
inactiveThumbImage: new NetworkImage(
|
||||
'https://cdn0.iconfinder.com/data/icons/multimedia-solid-30px/30/moon_dark_mode_night-512.png'),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import 'package:photos/ui/settings/info_section_widget.dart';
|
|||
import 'package:photos/ui/settings/security_section_widget.dart';
|
||||
import 'package:photos/ui/settings/social_section_widget.dart';
|
||||
import 'package:photos/ui/settings/support_section_widget.dart';
|
||||
import 'package:photos/ui/settings/theme_switch_widget.dart';
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
const SettingsPage({Key key}) : super(key: key);
|
||||
|
@ -26,6 +27,10 @@ class SettingsPage extends StatelessWidget {
|
|||
Widget _getBody(BuildContext context) {
|
||||
final hasLoggedIn = Configuration.instance.getToken() != null;
|
||||
final List<Widget> contents = [];
|
||||
contents.add(Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: const [ThemeSwitchWidget()]));
|
||||
final sectionDivider = Divider(
|
||||
height: 10,
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
|
||||
|
|
Loading…
Add table
Reference in a new issue