Flutter 颤振-如何确保即使在单击后退按钮后开关仍处于打开状态?
我有一个带有8个listTiles的设置菜单,如果我打开其中一个开关,问题是-当我单击“上一步”按钮并再次单击“设置”菜单时,开关关闭。。。即使单击了后退按钮,我还需要添加什么来确保开关处于打开状态 在这之后-what ever开关打开,这就是我想在另一个类中显示的彩色图像。。。。。这就是为什么我需要确保一次只打开一个开关,并且一旦用户单击后退按钮并单击返回到设置页面,开关仍然打开。。。我该怎么做这两件事呢Flutter 颤振-如何确保即使在单击后退按钮后开关仍处于打开状态?,flutter,dart,flutter-layout,flutter-dependencies,Flutter,Dart,Flutter Layout,Flutter Dependencies,我有一个带有8个listTiles的设置菜单,如果我打开其中一个开关,问题是-当我单击“上一步”按钮并再次单击“设置”菜单时,开关关闭。。。即使单击了后退按钮,我还需要添加什么来确保开关处于打开状态 在这之后-what ever开关打开,这就是我想在另一个类中显示的彩色图像。。。。。这就是为什么我需要确保一次只打开一个开关,并且一旦用户单击后退按钮并单击返回到设置页面,开关仍然打开。。。我该怎么做这两件事呢 导入“dart:ui”; 导入“package:Quran_highlighter/W
导入“dart:ui”;
导入“package:Quran_highlighter/Widgets/Styleing.dart”;
导入“包:adobe_xd/adobe_xd.dart”;
导入“dart:io”;
导入“package:Quran_highlighter/main.dart”;
导入“package:flatter/rendering.dart”;
导入“package:system_shortcuts/system_shortcuts.dart”;
导入“package:Quran_highlighter/Widgets/NavDrawer.dart”;
进口“包装:颤振/材料.省道”;
导入“package:zoom_widget/zoom_widget.dart”;
导入“package:flatter/signatures.dart”;
导入“package:Quran_highlighter/Widgets/size_config.dart”;
导入“package:flatter_slideable/flatter_slideable.dart”;
导入“包:颤振设置屏幕/颤振设置屏幕.dart”;
将“包:peek_和_pop/misc.dart”作为peek和popmisc导入;
导入“包:provider/provider.dart”;
类设置菜单扩展StatefulWidget{
@凌驾
_SettingsMenuState createState()=>_SettingsMenuState();
}
//正文:ListView.builder(
//物品计数:15,
//itemBuilder:(构建上下文,int索引){
//如果(索引==0){
//返回大小框(高度:15.0);
//}else如果(索引==5){
//返回大小框(高度:100.0);
// }
//返回容器(
//对齐:对齐.center,
类_SettingsNuState使用ChangeNotifier扩展状态{
//int_inc=0;
bool_启用;
bool _icymistEnable=true;
bool\u heartEnable=true;
bool\u deepoceanEnable=true;
bool_=true;
bool_=true;
bool _paradisenable=true;
bool_midnight paradisenable=true;
bool_midnight enable=true;
bool _icymistSwitch=false;
bool _icymistColor=false;
bool\u heartColor=false;
bool\u heartSwitch=false;
bool\u开关=假;
bool\u deepoceanColor=false;
bool\u flowerColor=false;
bool\u开关=假;
bool\u开关=假;
bool\u gardenColor=false;
bool_paradiseColor=false;
bool_paradiseSwitch=false;
bool_middnightParadiseSwitch=false;
bool_middnightParadiseColor=false;
bool_midnightColor=false;
bool_midnight switch=false;
字符串image1=“测试/资产/第1段-Alif laam meem no color/quranpg2-1.png”;
bool\u showPreview=false;
字符串图像=
“测试/资产/第1段-颜色-Alif Laam Meem/pg2_bonus_cool_ice10x_____2.png”;
//更改值(布尔值){
//设置状态(){
//_公司++;
//_值=值;
// });
// }
onpress(){
手势检测器(
onLongPress:(){
印刷品(“longpress”);
},
onLongPressUp:(){
打印(“longpressup”);
},
子:Card());
}
ChangeToIcMistimage(){
//设置状态(){
返回手势检测器(仅长按:(){
设置状态(){
_showPreview=true;
_形象=
“测试/资产/第1段-颜色-Alif Laam Meem/pg2_bonus_cool_ice10x_____2.png”;
});
});
}
// );
trythis(){
设置状态(){
重新绘制边界(
关键字:peek和popmisc.background,
孩子:MaterialApp(
标题:“Peek&Pop演示”,
主页:我的主页(标题:“Peek&Pop演示”);
});
}
Activatecymisthighlighter(){
设置状态(){
_icymistColor=true;
_icymistSwitch=true;
_icymistEnable=true;
_心色=假;
_heartSwitch=false;
//\u heartEnable=!\u heartEnable;
_heartEnable=true;
_颜色=假;
_开关=假;
_deepoceanEnable=true;
//_deepoceanEnable=!_deepoceanEnable;
_花色=假;
_开关=假;
_flowerEnable=true;
//_flowerEnable=!_flowerEnable;
_颜色=假;
_开关=假;
_gardenEnable=true;
//_gardenEnable=!_gardenEnable;
_paradiseColor=false;
_paradiseSwitch=false;
_paradisenable=true;
//_paradisenable=!_paradisenable;
_MiddnightParadiseColor=false;
_MiddnightParadiseSwitch=false;
_Midnight Paradisenable=真;
//_middnightparadisenable=!_middnightparadisenable;
_午夜色=假;
_midnight enable=true;
//_midnight enable=!_midnightEnable;
_午夜开关=假;
//notifyListeners();
});
}
激活接地指示灯(布尔值){
设置状态(){
_心色=真;
_heartSwitch=true;
_heartEnable=true;
_icymistColor=false;
_icymistSwitch=false;
_icymistEnable=true;
_颜色=假;
_开关=假;
_deepoceanEnable=true;
_花色=假;
_开关=假;
_flowerEnable=true;
_颜色=假;
_开关=假;
_gardenEnable=true;
_paradiseColor=false;
_paradiseSwitch=false;
_paradisenable=true;
_MiddnightParadiseColor=false;
_MiddnightParadiseSwitch=false;
_Midnight Paradisenable=真;
_午夜色=假;
_midnight enable=true;
_午夜开关=假;
notifyListeners();
//if(激活符号荧光灯(值)){
//设置状态(){
////_heartColor=false;
// });
}
// }
);
}
// }
激活的EpoceanHighlighter(布尔值){
设置状态(){
_深蓝色=真;
_deepoceanSwitch=true
import 'dart:ui';
import 'package:Quran_highlighter/Widgets/styling.dart';
import 'package:adobe_xd/adobe_xd.dart';
import 'dart:io';
import 'package:Quran_highlighter/main.dart';
import 'package:flutter/rendering.dart';
import 'package:system_shortcuts/system_shortcuts.dart';
import 'package:Quran_highlighter/Widgets/NavDrawer.dart';
import 'package:flutter/material.dart';
import 'package:zoom_widget/zoom_widget.dart';
import 'package:flutter/gestures.dart';
import 'package:Quran_highlighter/Widgets/size_config.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
import 'package:peek_and_pop/misc.dart' as PeekAndPopMisc;
import 'package:provider/provider.dart';
class SettingsMenu extends StatefulWidget {
@override
_SettingsMenuState createState() => _SettingsMenuState();
}
// body: ListView.builder(
// itemCount: 15,
// itemBuilder: (BuildContext context, int index) {
// if (index == 0) {
// return SizedBox(height: 15.0);
// } else if (index == 5) {
// return SizedBox(height: 100.0);
// }
// return Container(
// alignment: Alignment.center,
class _SettingsMenuState extends State<SettingsMenu> with ChangeNotifier {
// int _inc = 0;
bool _enabled;
bool _icymistEnable = true;
bool _heartEnable = true;
bool _deepoceanEnable = true;
bool _flowerEnable = true;
bool _gardenEnable = true;
bool _paradiseEnable = true;
bool _midnightparadisEnable = true;
bool _midnightEnable = true;
bool _icymistSwitch = false;
bool _icymistColor = false;
bool _heartColor = false;
bool _heartSwitch = false;
bool _deepoceanSwitch = false;
bool _deepoceanColor = false;
bool _flowerColor = false;
bool _flowerSwitch = false;
bool _gardenSwitch = false;
bool _gardenColor = false;
bool _paradiseColor = false;
bool _paradiseSwitch = false;
bool _midnightparadiseSwitch = false;
bool _midnightparadiseColor = false;
bool _midnightColor = false;
bool _midnightSwitch = false;
String image1 = "test/assets/Para 1 - Alif-laam-meem no color/quranpg2-1.png";
bool _showPreview = false;
String _image =
"test/assets/Para 1 - Color - Alif Laam Meem/pg2_bonus_cool_ice10x___2.png";
// changeValue(bool value) {
// setState(() {
// _inc++;
// _value = value;
// });
// }
onpress() {
GestureDetector(
onLongPress: () {
print("longpress");
},
onLongPressUp: () {
print("longpressup");
},
child: Card());
}
changetoIcyMistImage() {
// setState(() {
return GestureDetector(onLongPress: () {
setState(() {
_showPreview = true;
_image =
"test/assets/Para 1 - Color - Alif Laam Meem/pg2_bonus_cool_ice10x___2.png";
});
});
}
// );
trythis() {
setState(() {
RepaintBoundary(
key: PeekAndPopMisc.background,
child: MaterialApp(
title: 'Peek & Pop Demo',
home: MyHomePage(title: 'Peek & Pop Demo')));
});
}
activateIcyMistHighlighter() {
setState(() {
_icymistColor = true;
_icymistSwitch = true;
_icymistEnable = true;
_heartColor = false;
_heartSwitch = false;
// _heartEnable = !_heartEnable;
_heartEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
// _deepoceanEnable = !_deepoceanEnable;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
// _flowerEnable = !_flowerEnable;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
// _gardenEnable = !_gardenEnable;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
// _paradiseEnable = !_paradiseEnable;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
// _midnightparadisEnable = !_midnightparadisEnable;
_midnightColor = false;
_midnightEnable = true;
// _midnightEnable = !_midnightEnable;
_midnightSwitch = false;
// notifyListeners();
});
}
activateHeartHighlighter(bool value) {
setState(() {
_heartColor = true;
_heartSwitch = true;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
notifyListeners();
// if (activateIcyMistHighlighter(value)) {
// setState(() {
// // _heartColor = false;
// });
}
// }
);
}
// }
activateDeepOceanHighlighter(bool value) {
setState(() {
_deepoceanColor = true;
_deepoceanSwitch = true;
_deepoceanEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
});
}
activateFlowerHighlighter(bool value) {
setState(() {
_flowerColor = true;
_flowerSwitch = true;
_flowerEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
});
}
activateGardenHighlighter(bool value) {
setState(() {
_gardenColor = true;
_gardenSwitch = true;
_gardenEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
});
}
activateParadiseHighlighter(bool value) {
setState(() {
_paradiseColor = true;
_paradiseSwitch = true;
_paradiseEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
});
}
activateMidnightParadiseHighlighter(bool value) {
setState(() {
_midnightparadiseColor = true;
_midnightparadiseSwitch = true;
_midnightparadisEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_midnightColor = false;
_midnightEnable = true;
_midnightSwitch = false;
});
}
activateMidnightHighlighter(bool value) {
setState(() {
_midnightColor = true;
_midnightSwitch = true;
_midnightEnable = true;
_midnightparadiseColor = false;
_midnightparadiseSwitch = false;
_midnightparadisEnable = true;
_paradiseColor = false;
_paradiseSwitch = false;
_paradiseEnable = true;
_flowerColor = false;
_flowerSwitch = false;
_flowerEnable = true;
_gardenColor = false;
_gardenSwitch = false;
_gardenEnable = true;
_heartColor = false;
_heartSwitch = false;
_heartEnable = true;
_icymistColor = false;
_icymistSwitch = false;
_icymistEnable = true;
_deepoceanColor = false;
_deepoceanSwitch = false;
_deepoceanEnable = true;
});
}
getColor(bool enabled) {
if (_enabled == true) {
return Colors.blue;
} else {
return Colors.purple;
}
}
@override
Widget build(BuildContext context) {
///
return Scaffold(
backgroundColor: Colors.white,
// Color(0xFFFAFAFA),
appBar: AppBar(
backgroundColor: Colors.cyan,
title: Text("Settings Menu",
style: TextStyle(color: styling.appBarTextcolor)),
leading: FlatButton(
textColor: Colors.white,
child: Icon(styling.appBarBackArrowIcon),
onPressed: () {
Navigator.pop(context, false);
// WillPopScope(
// onWillPop: () async {
// // You can await in the calling widget for my_value and handle when complete.
// Navigator.pop(context, 'my_value');
// return false;
// },
// );
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => NavDrawer(),
// ));
}),
actions: <Widget>[
FlatButton(
textColor: Colors.white,
child: Text(
'Help',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
),
onPressed: () => print('Help'),
)
]),
body: new SingleChildScrollView(
child: Container(
constraints: BoxConstraints.expand(
// BoxConstraints
// BoxConstraints.expand(
height: 1200,
// .expand(
// width: SizeConfig.screenWidth / 0.5,
// height: SizeConfig.screenHeight / 0.5,
),
// children: [
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
// const SizedBox(
// height: 5.0,
// width: 10.0,
// ),
Text(
"English Highlighter Selection:",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
backgroundColor: Colors.cyan,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
Divider(
color: Colors.black,
),
// );
// }
// }
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.cyan,
),
tileColor:
_icymistColor ? Colors.cyan : Colors.transparent,
title: Text("Icy Mist"),
enabled: _icymistEnable,
subtitle: Text(
"A nice cooling Triple Gradient light blue highlighter with Teal and a hint of white"),
trailing: Icon(Icons.view_compact),
// onLongPress: changetoIcyMistImage()
// return GestureDetector(
// onLongPress: () {
// setState(() {
// _showPreview = true;
// _image = "assets/images/${images[index]}";
// });
// },
// onLongPressEnd: (details) {
// setState(() {
// _showPreview = false;
// });
// },
// child: Padding(
// padding: const EdgeInsets.all(4.0),
// child: Card(
// elevation: 4,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(5.0),
// ),
// clipBehavior: Clip.hardEdge,
// child: Image.asset("assets/images/${images[index]}"),
// ),
// ),
// );
// },
// ),
// if (_showPreview) ...[
// BackdropFilter(
// filter: ImageFilter.blur(
// sigmaX: 5.0,
// sigmaY: 5.0,
// ),
// child: Container(
// color: Colors.white.withOpacity(0.6),
// ),
// ),
// Container(
// child: Center(
// child: ClipRRect(
// borderRadius: BorderRadius.circular(10.0),
// child: Image.asset(
// _image,
// height: 300,
// width: 300,
// ),
onTap: () {
onpress();
}
// setState(() {
// _showPreview = true;
// _image =
// "test/assets/Para 1 - Color - Alif Laam Meem/pg2_bonus_cool_ice10x___2.png";
// });
// },
// onLongPressEnd: (details) {
// setState(() {
// _showPreview = false;
// });
// },
// onTap: () {
// // print("hey what is up");
// changetoIcyMistImage();
// setState(() {
// _color = !_color;
// });
// },
// ),
// }
),
// ),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _icymistSwitch,
activeColor: Colors.cyan,
// title: Text("final one"),
onChanged: (bool value) => activateIcyMistHighlighter(),
// Center(
// child: new Text("value ${_inc}"),
// ),
// ),
),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.red,
),
enabled: _heartEnable,
tileColor:
_heartColor ? Colors.red : Colors.transparent,
title: Text("Heart"),
subtitle: Text(
"A Strong Hearty Double Gradient highlighter with a hint of black at the top"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _heartSwitch,
activeColor: Colors.red,
// title: Text("final one"),
onChanged: (bool _heartColor) =>
activateHeartHighlighter(_heartColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.blue,
),
tileColor:
_deepoceanColor ? Colors.blue : Colors.transparent,
enabled: _deepoceanEnable,
// tileColor: Colors.transparent,
// getColor(!_enabled),
title: Text("Deep Ocean"),
subtitle: Text(
"Deep beneath the ocean comes this equisite Double Gradient highlighter with a hint of black"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _deepoceanSwitch,
activeColor: Colors.blue,
// title: Text("final one"),
onChanged: (bool _deepoceanColor) =>
activateDeepOceanHighlighter(_deepoceanColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.pink,
),
enabled: _flowerEnable,
tileColor:
_flowerColor ? Colors.pink : Colors.transparent,
title: Text("Flower"),
subtitle: Text(
"A bright Fuschia Flower highlighter that has a perfect shade of dark and light"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _flowerSwitch,
activeColor: Colors.pink,
// title: Text("final one"),
onChanged: (bool _flowerColor) =>
activateFlowerHighlighter(_flowerColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.green,
),
enabled: _gardenEnable,
tileColor:
_gardenColor ? Colors.green : Colors.transparent,
title: Text("Garden"),
subtitle: Text(
"A Foresty Green highlighter with a Double Gradient shade of light and dark"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _gardenSwitch,
activeColor: Colors.green,
// title: Text("final one"),
onChanged: (bool _gardenColor) =>
activateGardenHighlighter(_gardenColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.teal,
),
enabled: _paradiseEnable,
tileColor:
_paradiseColor ? Colors.teal : Colors.transparent,
title: Text("Paradise"),
subtitle: Text(
"A Nice cool Double Gradient Teal and skyBlue highligher which has ligh and dark shades"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _paradiseSwitch,
activeColor: Colors.teal,
// title: Text("final one"),
onChanged: (bool _paradiseColor) =>
activateParadiseHighlighter(_paradiseColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(Icons.highlight,
color: Colors.purpleAccent[700]),
enabled: _midnightparadisEnable,
tileColor: _midnightparadiseColor
? Colors.tealAccent
: Colors.transparent,
title: Text("Midnight Paradise"),
subtitle: Text(
"Most Exquisite to the eyes top with a nice Purple Midnight shade and the bottom with a Light Paradise light teal highlight"),
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _midnightparadiseSwitch,
activeColor: Colors.tealAccent,
// title: Text("final one"),
onChanged: (bool _midnightparadiseColor) =>
activateMidnightParadiseHighlighter(
_midnightparadiseColor)),
// ),
Divider(
color: Colors.black,
),
ListTile(
leading: Icon(
Icons.highlight,
color: Colors.purple,
),
enabled: _midnightEnable,
tileColor:
_midnightColor ? Colors.purple : Colors.transparent,
title: Text("Midnight"),
subtitle: Text(
"The night so dim the Midnight shade of purple mixed with a dark night highlighter"),
// tileColor: Colors.,
trailing: Icon(Icons.view_compact),
onTap: () {},
),
Switch(
// contentPadding: const EdgeInsets.all(0),
value: _midnightSwitch,
activeColor: Colors.purple,
// title: Text("final one"),
onChanged: (bool _midnightColor) =>
activateMidnightHighlighter(_midnightColor)),
// ),
Divider(
color: Colors.black,
),
]))));
}
}
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setBool('switch', true);
bool counter = prefs.getBool('switch') ?? false;
class Values{
static List<bool> checkBoxValues = [false, false...];
}
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setBool('switch', true);
Navigator.pop(context, true);