Flutter showTimePicker使用主题时底部的RenderFlex溢出14像素
您好,我对底部的showTimePicker对话框有问题 溢出了14个像素。Flutter showTimePicker使用主题时底部的RenderFlex溢出14像素,flutter,Flutter,您好,我对底部的showTimePicker对话框有问题 溢出了14个像素。 我认为我在主题数据中做了一些错误的事情,当我删除主题时,一切都很好 导入“包装:颤振/材料.省道”; void main()=>runApp(新的MyApp()); 类MyApp扩展了StatefulWidget{ @凌驾 _MyAppState createState()=>\u MyAppState(); } 类MyAppState扩展了状态{ int_red=0xFFFA2A2A; int_white=0xF
我认为我在主题数据中做了一些错误的事情,当我删除主题时,一切都很好
导入“包装:颤振/材料.省道”;
void main()=>runApp(新的MyApp());
类MyApp扩展了StatefulWidget{
@凌驾
_MyAppState createState()=>\u MyAppState();
}
类MyAppState扩展了状态{
int_red=0xFFFA2A2A;
int_white=0xFFFFFFFF;
int_black=0xFF000000;
@凌驾
小部件构建(构建上下文){
最终灯光=主题数据(
亮度:亮度,亮度,
primaryColorBrightness:Brightness.light,
脚手架背景颜色:颜色(_白色),
背景颜色:颜色(_白色),
原色:颜色(_白色),
主样本:颜色。红色,
accentColor:颜色(_红色),
accentTextTheme:TextTheme(
标题6:TextStyle(颜色:彩色(_白色)),
副标题1:
TextStyle(字体大小:45.0,字母间距:2,颜色:颜色(_白色)),
bodyText2:TextStyle(颜色:颜色(_白色)),
按钮:文本样式(颜色:颜色(_白色)),
),
accentIconTheme:const IconThemeData(
颜色:颜色,白色,
),
primaryTextTheme:TextTheme(
标题行6:TextStyle(颜色:颜色(_黑色)),
副标题1:
TextStyle(字体大小:45.0,字母间距:2,颜色:颜色(_黑色)),
按钮:文本样式(颜色:颜色(_黑色)),
),
主要主题:常量IconThemeData(
颜色:颜色。灰色,
),
textTheme:textTheme(
标题行5:文本样式(字体大小:50.0,字母间距:2),
标题行6:文本样式(字体大小:36.0,字母间距:2),
bodyText2:TextStyle(
字体大小:16.0,
),
),
按钮颜色:颜色(_白色),
buttonTheme:buttonTheme数据(
按钮颜色:颜色(_红色),
textTheme:buttonexttheme.primary,
),
iconTheme:const IconThemeData(
颜色:颜色。灰色,
),
);
返回材料PP(
主题:_light,//评论这句话很好
家:脚手架(
正文:
对齐(
孩子:建筑工人(
生成器:(上下文)=>列(
儿童:[
尺寸箱(高度:50,),
手势检测器(
onTap:(){
},
子:升起按钮(子:文本(“22:30”),按下时:()=>{
显示时间选择器(
上下文:上下文,
初始时间:常数时间(小时:7,分钟:0),
)
},),
)
],
),
),),
),
);
}
}
您可以在主题中设置大字体。
例如,将主题更改为:
final\u light=主题数据(
亮度:亮度,亮度,
primaryColorBrightness:Brightness.light,
脚手架背景颜色:颜色(_白色),
背景颜色:颜色(_白色),
原色:颜色(_白色),
主样本:颜色。红色,
accentColor:颜色(_红色),
accentTextTheme:TextTheme(
标题6:TextStyle(颜色:彩色(_白色)),
副标题1:
TextStyle(字体大小:22.0,字母间距:2,颜色:颜色(_白色)),
bodyText2:TextStyle(颜色:颜色(_白色)),
按钮:文本样式(颜色:颜色(_白色)),
),
accentIconTheme:const IconThemeData(
颜色:颜色,白色,
),
primaryTextTheme:TextTheme(
标题行6:TextStyle(颜色:颜色(_黑色)),
副标题1:
TextStyle(字体大小:22.0,字母间距:2,颜色:颜色(_黑色)),
按钮:文本样式(颜色:颜色(_黑色)),
),
主要主题:常量IconThemeData(
颜色:颜色。灰色,
),
textTheme:textTheme(
标题行5:文本样式(字体大小:20.0,字母间距:2),
标题行6:文本样式(字体大小:18.0,字母间距:2),
bodyText2:TextStyle(
字体大小:16.0,
),
),
按钮颜色:颜色(_白色),
buttonTheme:buttonTheme数据(
按钮颜色:颜色(_红色),
textTheme:buttonexttheme.primary,
),
iconTheme:const IconThemeData(
颜色:颜色。灰色,
),
);
哪个文本主题?showTimePicker文本依赖于哪个文本主题?副标题1:TextStyle(fontSize:22.0,字母间距:2,颜色:颜色(_-white)),
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _red = 0xFFFA2A2A;
int _white = 0xFFFFFFFF;
int _black = 0xFF000000;
@override
Widget build(BuildContext context) {
final _light = ThemeData(
brightness: Brightness.light,
primaryColorBrightness: Brightness.light,
scaffoldBackgroundColor: Color(_white),
backgroundColor: Color(_white),
primaryColor: Color(_white),
primarySwatch: Colors.red,
accentColor: Color(_red),
accentTextTheme: TextTheme(
headline6: TextStyle(color: Color(_white)),
subtitle1:
TextStyle(fontSize: 45.0, letterSpacing: 2, color: Color(_white)),
bodyText2: TextStyle(color: Color(_white)),
button: TextStyle(color: Color(_white)),
),
accentIconTheme: const IconThemeData(
color: Colors.white,
),
primaryTextTheme: TextTheme(
headline6: TextStyle(color: Color(_black)),
subtitle1:
TextStyle(fontSize: 45.0, letterSpacing: 2, color: Color(_black)),
button: TextStyle(color: Color(_black)),
),
primaryIconTheme: const IconThemeData(
color: Colors.grey,
),
textTheme: TextTheme(
headline5: TextStyle(fontSize: 50.0, letterSpacing: 2),
headline6: TextStyle(fontSize: 36.0, letterSpacing: 2),
bodyText2: TextStyle(
fontSize: 16.0,
),
),
buttonColor: Color(_white),
buttonTheme: ButtonThemeData(
buttonColor: Color(_red),
textTheme: ButtonTextTheme.primary,
),
iconTheme: const IconThemeData(
color: Colors.grey,
),
);
return MaterialApp(
theme: _light,//commenting this line works fine
home: Scaffold(
body:
Align(
child: Builder(
builder: (context) => Column(
children: [
SizedBox(height: 50,),
GestureDetector(
onTap: () {
},
child: RaisedButton(child: Text("22:30"),onPressed: ()=>{
showTimePicker(
context: context,
initialTime: const TimeOfDay(hour: 7, minute: 0),
)
},),
)
],
),
),),
),
);
}
}