Created
February 7, 2025 04:44
-
-
Save ffpresents/570547a74e5f827aec43057eb2454701 to your computer and use it in GitHub Desktop.
TextField problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MaterialApp( | |
builder: (context, child) => const MyApp(), | |
)); | |
} | |
class MyApp extends StatefulWidget { | |
const MyApp({super.key}); | |
@override | |
State<StatefulWidget> createState() { | |
return _MyAppState(); | |
} | |
} | |
class _MyAppState extends State<MyApp> { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Container( | |
color: Colors.blueAccent, | |
child: Column( | |
children: [ | |
const Spacer(), | |
Text( | |
'Media query inset vertical ${MediaQuery.of(context).viewInsets.vertical}', | |
style: const TextStyle(fontSize: 14, color: Colors.black), | |
), | |
Padding( | |
padding: EdgeInsets.only( | |
bottom: MediaQuery.of(context).viewInsets.vertical), | |
child: Container( | |
padding: const EdgeInsets.all(16), | |
color: Colors.indigo, | |
child: TextField( | |
controller: TextEditingController(), | |
focusNode: FocusNode(), | |
style: const TextStyle(fontSize: 14, color: Colors.black), | |
cursorColor: Colors.white, | |
), | |
), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment