| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | ||||
| import 'dung/widget_dung_supply.dart'; | |||||
| import 'plant/widget_plant_supply.dart'; | |||||
| import 'spraying/widget_spraying_supply.dart'; | |||||
| import 'state_management_helper/change_file_controller.dart'; | import 'state_management_helper/change_file_controller.dart'; | ||||
| class ActionScreen extends StatefulWidget { | class ActionScreen extends StatefulWidget { | ||||
| final int idAction; | final int idAction; | ||||
| final String activityType; | |||||
| final String title; | final String title; | ||||
| ActionScreen({@required this.idAction, @required this.title}); | |||||
| ActionScreen( | |||||
| {@required this.idAction, | |||||
| @required this.title, | |||||
| @required this.activityType}); | |||||
| @override | @override | ||||
| _ActionScreenState createState() => _ActionScreenState(); | _ActionScreenState createState() => _ActionScreenState(); | ||||
| ); | ); | ||||
| } | } | ||||
| // | |||||
| // GENERATE SUPPLY | |||||
| // | |||||
| Widget generateSupply(String activityType) { | |||||
| switch (activityType) { | |||||
| case 'ACTIVE_TYPE_NURSERY': | |||||
| return Container(); | |||||
| break; | |||||
| case 'ACTIVE_TYPE_PLANTING': | |||||
| return Column( | |||||
| children: [ | |||||
| Container( | |||||
| width: double.infinity, | |||||
| height: 16, | |||||
| color: Colors.grey[200], | |||||
| ), | |||||
| WidgetPlantSupply(currentItems: [], onChangeSupplies: (value) {}), | |||||
| ], | |||||
| ); | |||||
| break; | |||||
| case 'ACTIVE_TYPE_FERTILIZE': | |||||
| return Column( | |||||
| children: [ | |||||
| Container( | |||||
| width: double.infinity, | |||||
| height: 16, | |||||
| color: Colors.grey[200], | |||||
| ), | |||||
| WidgetDungSupply(currentItems: [], onChangeSupplies: (value) {}), | |||||
| ], | |||||
| ); | |||||
| break; | |||||
| case 'ACTIVE_TYPE_SPRAYING_PESTICIDES': | |||||
| return Column( | |||||
| children: [ | |||||
| Container( | |||||
| width: double.infinity, | |||||
| height: 16, | |||||
| color: Colors.grey[200], | |||||
| ), | |||||
| WidgetSprayingSupply( | |||||
| currentItems: [], onChangeSupplies: (value) {}), | |||||
| ], | |||||
| ); | |||||
| break; | |||||
| default: | |||||
| return Container(); | |||||
| break; | |||||
| } | |||||
| } | |||||
| @override | @override | ||||
| Widget build(BuildContext context) => KeyboardDismisser( | Widget build(BuildContext context) => KeyboardDismisser( | ||||
| gestures: [ | gestures: [ | ||||
| ], | ], | ||||
| ), | ), | ||||
| ), | ), | ||||
| generateSupply(widget.activityType), | |||||
| Container( | Container( | ||||
| width: double.infinity, | width: double.infinity, | ||||
| height: 16, | height: 16, |
| import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
| import 'package:farm_tpf/custom_model/ActionType.dart'; | import 'package:farm_tpf/custom_model/ActionType.dart'; | ||||
| import 'package:farm_tpf/data/repository/repository.dart'; | import 'package:farm_tpf/data/repository/repository.dart'; | ||||
| import 'package:farm_tpf/models/index.dart'; | |||||
| import 'package:farm_tpf/presentation/custom_widgets/loading_list_page.dart'; | import 'package:farm_tpf/presentation/custom_widgets/loading_list_page.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/sc_action.dart'; | import 'package:farm_tpf/presentation/screens/actions/sc_action.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/plot_detail/bloc/cubit/plot_action_type_cubit.dart'; | import 'package:farm_tpf/presentation/screens/plot_detail/bloc/cubit/plot_action_type_cubit.dart'; | ||||
| import 'package:farm_tpf/utils/const_assets.dart'; | import 'package:farm_tpf/utils/const_assets.dart'; | ||||
| import 'package:farm_tpf/utils/const_color.dart'; | import 'package:farm_tpf/utils/const_color.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/scheduler.dart'; | |||||
| import 'package:flutter_bloc/flutter_bloc.dart'; | import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| return GestureDetector( | return GestureDetector( | ||||
| onTap: () { | onTap: () { | ||||
| Get.to(ActionScreen( | Get.to(ActionScreen( | ||||
| idAction: actionType.id, title: actionType.description)); | |||||
| idAction: actionType.id, | |||||
| title: actionType.description, | |||||
| activityType: actionType.name, | |||||
| )); | |||||
| }, | }, | ||||
| child: Container( | child: Container( | ||||
| margin: EdgeInsets.all(8), | margin: EdgeInsets.all(8), |