Browse Source

show executeBy action other

master
daivph 5 years ago
parent
commit
7ac8128d07
2 changed files with 28 additions and 0 deletions
  1. +4
    -0
      lib/custom_model/Other.dart
  2. +24
    -0
      lib/presentation/screens/actions/other/sc_edit_action_other.dart

+ 4
- 0
lib/custom_model/Other.dart View File

String media; String media;
String executeDate; String executeDate;
String description; String description;
String createdByName;
String activityTypeName; String activityTypeName;


Other( Other(
this.media, this.media,
this.executeDate, this.executeDate,
this.description, this.description,
this.createdByName,
this.activityTypeName}); this.activityTypeName});


Other.fromJson(Map<String, dynamic> json) { Other.fromJson(Map<String, dynamic> json) {
media = json['media']; media = json['media'];
executeDate = json['executeDate']; executeDate = json['executeDate'];
description = json['description']; description = json['description'];
createdByName = json['createdByName'];
activityTypeName = json['activityTypeName']; activityTypeName = json['activityTypeName'];
} }


data['media'] = this.media; data['media'] = this.media;
data['executeDate'] = this.executeDate; data['executeDate'] = this.executeDate;
data['description'] = this.description; data['description'] = this.description;
data['createdByName'] = this.createdByName;
data['activityTypeName'] = this.activityTypeName; data['activityTypeName'] = this.activityTypeName;
return data; return data;
} }

+ 24
- 0
lib/presentation/screens/actions/other/sc_edit_action_other.dart View File

final _repository = Repository(); final _repository = Repository();
GlobalKey<FormState> _formKey = GlobalKey(); GlobalKey<FormState> _formKey = GlobalKey();
bool _autoValidate = false; bool _autoValidate = false;
var pref = LocalPref();
Other _other = Other(); Other _other = Other();
final _descriptionController = TextEditingController(); final _descriptionController = TextEditingController();
final _executeByController = TextEditingController();


List<ActionType> _actionTypes = List<ActionType>(); List<ActionType> _actionTypes = List<ActionType>();
ActionType _actionType; ActionType _actionType;
List<String> filePaths = List<String>(); List<String> filePaths = List<String>();
var changeFileController = Get.put(ChangeFileController()); var changeFileController = Get.put(ChangeFileController());


Future<Null> getSharedPrefs() async {
var currentFullName = await pref.getString(DATA_CONST.CURRENT_FULL_NAME);
_executeByController.text = currentFullName ?? "";
}

@override @override
void initState() { void initState() {
super.initState(); super.initState();
getSharedPrefs();
changeFileController.initValue(); changeFileController.initValue();
var parsedExecuteDate = var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
); );
} }


Widget _executeByField() {
return TextFormField(
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Người thực hiện"),
enabled: false,
controller: _executeByController,
onSaved: (newValue) {},
);
}

_actionAppBar() { _actionAppBar() {
IconButton iconButton; IconButton iconButton;
if (1 == 1) { if (1 == 1) {
_other.activityId = widget.activityId; _other.activityId = widget.activityId;
_descriptionController.text = _descriptionController.text =
_other.description ?? ""; _other.description ?? "";
_executeByController.text = _other.createdByName;


//select harvest //select harvest
getActionTypeBloc.getActionTypes((data) { getActionTypeBloc.getActionTypes((data) {
SizedBox( SizedBox(
height: 8.0, height: 8.0,
), ),
_executeByField(),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>( BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) { builder: (context, state) {
if (state is MediaHelperSuccess) { if (state is MediaHelperSuccess) {
@override @override
void dispose() { void dispose() {
_descriptionController.dispose(); _descriptionController.dispose();
_executeByController.dispose();
super.dispose(); super.dispose();
} }
} }

Loading…
Cancel
Save