所以我希望 TextField
中的文本到最底部。
import 'package:flutter/material.dart';
void main() => runApp(const Home());
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: TextField(
textAlignVertical: TextAlignVertical(y: -0.0),
decoration: InputDecoration(filled: true)
),
),
),
);
}
}
我尝试使用 textAlignVertical
但它不起作用。
答案 0 :(得分:1)
尝试添加 contentPadding
:
import 'package:flutter/material.dart';
void main() => runApp(const Home());
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: TextField(
textAlignVertical: TextAlignVertical(y: -0.0),
decoration: InputDecoration(
filled: true,
contentPadding: EdgeInsets.only(bottom: 0.0), //here
),
),
),
),
);
}
}