【发布时间】:2022-08-11 21:19:44
【问题描述】:
现在,我有这样的设计:
我想实现这一点:
这是我的主页,我想在点击设置按钮时出现
这是我的代码:
设置.dart
import \'dart:ui\';
import \'package:font_awesome_flutter/font_awesome_flutter.dart\';
import \'package:settings_ui/settings_ui.dart\';
import \'package:responsive_sizer/responsive_sizer.dart\';
import \'package:flutter/cupertino.dart\';
import \'package:flutter/material.dart\';
class SettingsUIPomodoro extends StatefulWidget {
const SettingsUIPomodoro({Key? key}) : super(key: key);
@override
State<SettingsUIPomodoro> createState() => _SettingsUIPomodoroState();
}
class _SettingsUIPomodoroState extends State<SettingsUIPomodoro> {
final List<String> _items = [\"sound1\",\"sound2\",\"sound3\",\"sound4\"];
String _dropDownValue = \'sound1\';
final List<String> _timeBoxing = [\"5min\",\"10min\",\"15min\",\"20min\"];
String _timeBoxingValue = \'5min\';
final List<String> _Notification = [\"Every\",\"Last\",];
String _NotificationValue = \'Every\';
bool _lights = false;
@override
Widget build(BuildContext context) {
return ResponsiveSizer(
builder: (context, orientation, screenType) {
return Device.screenType == ScreenType.mobile
? Scaffold(
extendBodyBehindAppBar: true,
backgroundColor: Color.fromARGB(100, 22, 44, 33),
body: Center(
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Container(
height: double.maxFinite,
width: double.maxFinite,
decoration: BoxDecoration(
color: Color(0xffF6F6F6),
borderRadius: BorderRadius.all(
Radius.circular(20.0),
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
Text(\"Timer (minutes)\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
SizedBox(height: 20,),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Pomodoro\",
style: TextStyle(
fontSize: 20,
color: Colors.grey
),),
SizedBox(
width: 100,
child: TextField(
cursorColor: Color(0xff3B3B3B),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
),
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
decorationStyle: TextDecorationStyle.dotted,
decorationColor: Color(0xffF6F6F6),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
],
),
SizedBox(width: 20,),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Short Break\",
style: TextStyle(
fontSize: 20,
color: Colors.grey
),),
SizedBox(
width: 100,
child: TextField(
cursorColor: Color(0xff3B3B3B),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
),
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
decorationStyle: TextDecorationStyle.dotted,
decorationColor: Color(0xffF6F6F6),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
],
),
SizedBox(width: 20,),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Long Break\",
style: TextStyle(
fontSize: 20,
color: Colors.grey
),),
SizedBox(
width: 100,
child: TextField(
cursorColor: Color(0xff3B3B3B),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
),
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
decorationStyle: TextDecorationStyle.dotted,
decorationColor: Color(0xffF6F6F6),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
],
),
],
),
),
SizedBox(height: 20,),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Long break interval\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
SizedBox(
width: 100,
child: TextField(
cursorColor: Color(0xff3B3B3B),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
),
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
decorationStyle: TextDecorationStyle.dotted,
decorationColor: Color(0xffF6F6F6),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
],
),
SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Alarm Sound\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
SizedBox(width: 10,),
DropdownButton(
value: _dropDownValue,
items: _items.map((String _items){
return DropdownMenuItem(
value: _items,
child: Text(_items));
}).toList(),
onChanged: (String? newvalue){
setState(() {
_dropDownValue = newvalue!;
});
},
)
],
),
SizedBox(height: 20,),
Divider(color: Colors.grey,),
SizedBox(height: 10,),
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 10,),
Center(
child: Text(\"Do you want to do Timeboxing beside Pomodoro technique?\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
),
SizedBox(height: 15,),
Center(
child: const Text(\"Is Elon Musk habit to make it a ninja in time management, consists in set a short time, let say 5 min and really be focused on a very short period of time, when time is over. Begins another 5 minutes and another task\",
style: TextStyle(
fontSize: 20,
color: Colors.grey
),),
),
SizedBox(height: 10,),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: Text(\"Choose your timeboxing alarm\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
),
DropdownButton(
value: _dropDownValue,
items: _items.map((String _items){
return DropdownMenuItem(
value: _items,
child: Text(_items));
}).toList(),
onChanged: (String? newvalue){
setState(() {
_dropDownValue = newvalue!;
});
},
)
],
),
SizedBox(height: 10,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: Text(\"Alarm Sound Each\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
),
DropdownButton(
value: _timeBoxingValue,
items: _timeBoxing.map((String _items){
return DropdownMenuItem(
value: _items,
child: Text(_items));
}).toList(),
onChanged: (String? newvalue){
setState(() {
_timeBoxingValue = newvalue!;
});
},
)
],
)
],
),
),
Divider(color: Colors.grey,),
SwitchListTile(
activeColor: Colors.grey,
title: const Text(\'Dark mode?\'),
value: _lights,
onChanged: (bool value) {
setState(() {
_lights = value;
});
},
secondary: const Icon(Icons.lightbulb_outline),
),
Divider(color: Colors.grey,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(\"Notification\",
style: TextStyle(
fontSize: 20,
color: Colors.black
),),
SizedBox(width: 10,),
DropdownButton(
value: _NotificationValue,
items: _Notification.map((String _items){
return DropdownMenuItem(
value: _items,
child: Text(_items));
}).toList(),
onChanged: (String? newvalue){
setState(() {
_NotificationValue = newvalue!;
});
},
),
SizedBox(width: 10,),
DropdownButton(
value: _timeBoxingValue,
items: _timeBoxing.map((String _items){
return DropdownMenuItem(
value: _items,
child: Text(_items));
}).toList(),
onChanged: (String? newvalue){
setState(() {
_timeBoxingValue = newvalue!;
});
},
),
],
),
],
),
),
),
),
),
),
)
: Scaffold();
}
);
}
}
我尝试将 backgroundcolor 设置为 color.transparent,但不工作屏幕只显示黑色背景,这不是我的想法
如何解决这个问题?先感谢您
-
不确定你想达到什么目标。你想在你家的顶部打开一个对话框吗?
-
你好 Alaindeseine,我想要的是我打开设置,我主页的背景也显示出来,就像第二个截图一样
标签: flutter