Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : import 'package:redfire/extensions.dart';
4 :
5 : import '../../../app_state.dart';
6 : import '../../../sections/actions/create_section_action.dart';
7 : import '../../../sections/actions/update_new_section_v_m_action.dart';
8 :
9 : class NewSectionItem extends StatelessWidget {
10 7 : const NewSectionItem({Key? key}) : super(key: key);
11 :
12 2 : @override
13 : Widget build(BuildContext context) {
14 2 : return Padding(
15 : padding: const EdgeInsets.fromLTRB(10.0, 8.0, 10.0, 4.0),
16 2 : child: TextFormField(
17 : autofocus: true,
18 2 : decoration: InputDecoration(
19 4 : border: OutlineInputBorder(borderRadius: BorderRadius.circular(5)),
20 : hintText: 'Enter a name...',
21 2 : suffixIcon: Padding(
22 : padding: const EdgeInsets.only(right: 8.0),
23 2 : child: FloatingActionButton(
24 1 : onPressed: () =>
25 1 : context.dispatch<AppState>(const CreateSectionAction()),
26 : backgroundColor: Colors.blue,
27 : foregroundColor: Colors.white,
28 : mini: true,
29 : elevation: 1,
30 : child: const Icon(Icons.add),
31 : ),
32 : ),
33 : ),
34 1 : onChanged: (value) =>
35 2 : context.dispatch<AppState>(UpdateNewSectionVMAction(name: value)),
36 : ),
37 : );
38 : }
39 : }
|