cpd_2022_zi/lib/widgets/text_formfield.dart

25 lines
717 B
Dart
Raw Permalink Normal View History

2023-02-15 23:28:19 +01:00
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:smoke_cess_app/providers/input_provider.dart';
2023-02-15 23:28:19 +01:00
class MyTextFormField extends StatelessWidget {
final String _description;
2023-02-15 23:28:19 +01:00
const MyTextFormField(
this._description, {
2023-02-15 23:28:19 +01:00
super.key,
});
@override
Widget build(BuildContext context) {
var inputProvider = context.watch<InputProvider>();
2023-02-15 23:28:19 +01:00
return TextFormField(
controller: inputProvider.textController,
decoration: InputDecoration(hintText: _description),
2023-02-15 23:28:19 +01:00
validator: (String? value) =>
value == null || value.isEmpty ? 'Text eingeben' : null,
keyboardType: TextInputType.multiline,
maxLines: null,
);
}
}