fix: edit product page now moves with keyboard

This commit is contained in:
2026-08-04 20:59:23 +02:00
parent dd5cc1e517
commit 0c90a719a1
2 changed files with 13 additions and 3 deletions
+11 -1
View File
@@ -46,7 +46,10 @@ class _ProductFormViewState extends State<ProductFormView> {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
_loadProductIfNeeded();
});
}
Future<void> _loadProductIfNeeded() async {
@@ -335,7 +338,7 @@ class _ProductFormViewState extends State<ProductFormView> {
),
],
),
resizeToAvoidBottomInset: false,
resizeToAvoidBottomInset: true,
body: _isLoading
? const Center(child: CircularProgressIndicator())
: Center(
@@ -344,6 +347,8 @@ class _ProductFormViewState extends State<ProductFormView> {
child: Form(
key: _formKey,
child: ListView(
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
padding: const EdgeInsets.all(24),
children: [
_buildImagePicker(context),
@@ -389,6 +394,7 @@ class _ProductFormViewState extends State<ProductFormView> {
setState(() {
_selectedCategory = value;
});
FocusScope.of(context).nextFocus();
},
);
},
@@ -449,6 +455,10 @@ class _ProductFormViewState extends State<ProductFormView> {
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) {
FocusScope.of(context).unfocus();
},
validator: (value) {
final number = int.tryParse(value ?? '');
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.12
version: 1.0.13
environment:
sdk: ^3.12.2