add structure
This commit is contained in:
49
lib/widget/local_text_field.dart
Normal file
49
lib/widget/local_text_field.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/model/language_model.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
|
||||
import 'localization/app_translations.dart';
|
||||
|
||||
class LocalTextField extends StatelessWidget {
|
||||
final TextEditingController textEditingController;
|
||||
final String labelKey;
|
||||
final Widget icon;
|
||||
final String Function(String) validator;
|
||||
final TextInputType textInputType;
|
||||
final int maxLines;
|
||||
const LocalTextField(
|
||||
{Key key,
|
||||
this.textEditingController,
|
||||
this.labelKey,
|
||||
this.icon,
|
||||
this.validator,
|
||||
this.textInputType,
|
||||
this.maxLines})
|
||||
: super(key: key);
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: TextFormField(
|
||||
controller: textEditingController,
|
||||
autofocus: false,
|
||||
cursorColor: primaryColor,
|
||||
keyboardType: textInputType,
|
||||
maxLines: maxLines,
|
||||
decoration: new InputDecoration(
|
||||
labelText: AppTranslations.of(context).text(labelKey),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: this.icon,
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: this.validator,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user