Untitled
unknown
plain_text
2 years ago
1.4 kB
4
Indexable
import 'package:flutter/material.dart'; class ModalBottom extends StatelessWidget { ModalBottom({super.key, required this.addTask}); final Function addTask; String textValue = ""; void _handleOnclick(BuildContext context) { if (textValue.isEmpty) { return; } addTask(textValue); Navigator.pop(context); } @override Widget build(BuildContext context) { return Padding( padding: MediaQuery.of(context).viewInsets, child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ TextField( onChanged: (text) { textValue = text; }, //bat su kien nhan gia tri input value decoration: const InputDecoration( border: OutlineInputBorder(), labelText: 'Your Task', ), ), const SizedBox( height: 20, ), SizedBox( width: double.infinity, child: ElevatedButton( onPressed: () => _handleOnclick(context), child: const Text('Add'), ), ) ], )), ); } }
Editor is loading...