Untitled

 avatar
unknown
dart
2 years ago
1.0 kB
3
Indexable
class EditRowScreen extends ConsumerWidget {
  const EditRowScreen({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context, ScopedReader watch) {
    final editingRow = watch(editingRowProvider).state;
    final rowValue = watch(rowValueProvider).state;

    return Scaffold(
      appBar: AppBar(
        title: Text(editingRow.toString().split('.').last),
        actions: [
          TextButton(
            onPressed: () {
              context.read(rowValueProvider).state = rowValue;
              Navigator.pop(context);
            },
            child: Text('Save'),
          ),
        ],
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: TextField(
          onChanged: (value) {
            context.read(rowValueProvider).state = value;
          },
          controller: TextEditingController(text: rowValue),
          decoration: InputDecoration(
            labelText: editingRow.toString().split('.').last,
          ),
        ),
      ),
    );
  }
}
Editor is loading...