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

@@ -5,6 +5,7 @@ class Other {
String media;
String executeDate;
String description;
String createdByName;
String activityTypeName;

Other(
@@ -14,6 +15,7 @@ class Other {
this.media,
this.executeDate,
this.description,
this.createdByName,
this.activityTypeName});

Other.fromJson(Map<String, dynamic> json) {
@@ -23,6 +25,7 @@ class Other {
media = json['media'];
executeDate = json['executeDate'];
description = json['description'];
createdByName = json['createdByName'];
activityTypeName = json['activityTypeName'];
}

@@ -34,6 +37,7 @@ class Other {
data['media'] = this.media;
data['executeDate'] = this.executeDate;
data['description'] = this.description;
data['createdByName'] = this.createdByName;
data['activityTypeName'] = this.activityTypeName;
return data;
}

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

@@ -40,8 +40,10 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
final _repository = Repository();
GlobalKey<FormState> _formKey = GlobalKey();
bool _autoValidate = false;
var pref = LocalPref();
Other _other = Other();
final _descriptionController = TextEditingController();
final _executeByController = TextEditingController();

List<ActionType> _actionTypes = List<ActionType>();
ActionType _actionType;
@@ -50,9 +52,15 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
List<String> filePaths = List<String>();
var changeFileController = Get.put(ChangeFileController());

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

@override
void initState() {
super.initState();
getSharedPrefs();
changeFileController.initValue();
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
@@ -218,6 +226,16 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
);
}

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

_actionAppBar() {
IconButton iconButton;
if (1 == 1) {
@@ -281,6 +299,7 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
_other.activityId = widget.activityId;
_descriptionController.text =
_other.description ?? "";
_executeByController.text = _other.createdByName;

//select harvest
getActionTypeBloc.getActionTypes((data) {
@@ -338,6 +357,10 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) {
if (state is MediaHelperSuccess) {
@@ -361,6 +384,7 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
@override
void dispose() {
_descriptionController.dispose();
_executeByController.dispose();
super.dispose();
}
}

Loading…
Cancel
Save