support padding width

This commit is contained in:
Siyi Guo committed 2023-04-13 16:55:24 +08:00
1 parent 90f53a0578
commit b430697b5c
2 files changed
+27 -5

No files matched your search

+24 -3
View File
@@ -81,13 +81,15 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
double width = 800;
double height = 1200;
double paddingWidth = 100;
Future<void> onClickEnter() async {
resetScreen();
await Navigator.push(
context,
PageRouteBuilder<void>(
opaque: false,
pageBuilder: (_, __, ___) => const ImagePage(),
pageBuilder: (_, __, ___) => ImagePage(paddingWidth: paddingWidth.toInt()),
));
getScreenSize();
}
@@ -101,7 +103,6 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
@override
void onWindowResize() {
super.onWindowResize();
}
void getScreenSize() {
@@ -172,9 +173,29 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
onSubmitted: (_) => onClickEnter(),
),
),
20.gapRow,
'paddingWidth:'.toText(size: 9.dp),
SizedBox(
height: 20.dp,
width: 50.dp,
child: TextField(
controller: TextEditingController(text: '${paddingWidth.toInt()}'),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
onChanged: (number) {
paddingWidth = double.tryParse(number) ?? 100;
},
style: TextStyle(fontSize: 14.dp, fontWeight: FontWeight.w600),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(2.dp),
hintStyle: TextStyle(fontSize: 14.dp, color: Colors.grey, fontWeight: FontWeight.w600),
),
onSubmitted: (_) => onClickEnter(),
),
),
],
),
'(image width will be width - 100)'.toText(size: 10.dp, color: Colors.grey),
'(image width will be width - paddingWidth)'.toText(size: 10.dp, color: Colors.grey),
30.dp.gapColumn,
EasyButton(
text: 'Enter',