Compare commits

...

2 Commits

Author SHA1 Message Date
andrei a613292095 modified card and dissmiss padding 2021-11-04 21:28:32 -04:00
andrei b8c49132d7 add form text input aciton 2021-11-04 21:27:55 -04:00
2 changed files with 80 additions and 71 deletions

View File

@ -76,15 +76,14 @@ class _AddFormState extends State<AddForm> {
}
return null;
},
onFieldSubmitted: (value) {
if (_formKey.currentState!.validate()) {
FocusScope.of(context).requestFocus(_TemplateFocusNode);
}
},
textInputAction: TextInputAction.next,
onFieldSubmitted: (value) =>
_formKey.currentState!.validate(),
decoration: const InputDecoration(labelText: 'Label')),
TextFormField(
decoration:
const InputDecoration(labelText: 'Description(optional)'),
textInputAction: TextInputAction.next,
onChanged: (value) {
_listDesc = value;
},

View File

@ -43,6 +43,9 @@ class _MainListPageState extends State<MainListPage> {
int _selectedPage = data.Page.lists.index;
List<data.List> lists = [];
final double _marginHorizontal = 10;
final double _cardSpacing = 4;
Future<void> _loadData(data.Page listType) async {
lists.clear();
var res = await DBHelper.dbHelper.getAllLists(listType);
@ -66,6 +69,9 @@ class _MainListPageState extends State<MainListPage> {
@override
Widget build(BuildContext context) {
final EdgeInsets cardMargin =
EdgeInsets.symmetric(vertical: _cardSpacing, horizontal: 0);
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
@ -83,7 +89,9 @@ class _MainListPageState extends State<MainListPage> {
tooltip: 'Add List',
child: const Icon(Icons.add),
),
body: RefreshIndicator(
body: Container(
padding: EdgeInsets.symmetric(horizontal: _marginHorizontal),
child: RefreshIndicator(
onRefresh: () => _loadData(data.Page.values[_selectedPage]),
child: ListView.builder(
itemCount: lists.length,
@ -92,6 +100,7 @@ class _MainListPageState extends State<MainListPage> {
direction: DismissDirection.startToEnd,
key: Key(lists[index].id.toString()),
background: Card(
margin: cardMargin,
color: Colors.red,
child: Row(
children: const [
@ -137,6 +146,7 @@ class _MainListPageState extends State<MainListPage> {
});
},
child: Card(
margin: cardMargin,
child: ListTile(
onTap: () {
Navigator.push(
@ -152,7 +162,7 @@ class _MainListPageState extends State<MainListPage> {
),
),
);
})),
}))),
bottomNavigationBar: BottomNavigationBar(
elevation: 4,
currentIndex: _selectedPage,