Browse Source

reduce size action button

master
daivph 5 years ago
parent
commit
52d1be935a
4 changed files with 39 additions and 74 deletions
  1. +1
    -1
      ios/Flutter/.last_build_id
  2. +3
    -3
      ios/Runner.xcodeproj/project.pbxproj
  3. +1
    -1
      lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart
  4. +34
    -69
      lib/presentation/screens/plot_detail/sc_plot_action.dart

+ 1
- 1
ios/Flutter/.last_build_id View File

82c40f0e586e955df1aed37a310a3b7b
440505e9ea1eee7043d2cbfeb318f6bc

+ 3
- 3
ios/Runner.xcodeproj/project.pbxproj View File

"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",

+ 1
- 1
lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart View File

ThousandsFormatter( ThousandsFormatter(
formatter: NumberFormat("#,###.##", "es"), allowFraction: true) formatter: NumberFormat("#,###.##", "es"), allowFraction: true)
], ],
decoration: InputDecoration(labelText: "Chiều dài mần"),
decoration: InputDecoration(labelText: "Chiều dài mầm"),
controller: _seedLengthController, controller: _seedLengthController,
onSaved: (newValue) { onSaved: (newValue) {
_nursery.seedLength = newValue.parseDoubleThousand(); _nursery.seedLength = newValue.parseDoubleThousand();

+ 34
- 69
lib/presentation/screens/plot_detail/sc_plot_action.dart View File

} }


_initActionButtons() { _initActionButtons() {
actions.add(ActionType(
plot_action_nursery,
null,
EditActionNurseryScreen(
cropId: widget.cropId,
)));
actions.add(ActionType(
plot_action_plant,
null,
EditActionPlantScreen(
cropId: widget.cropId,
)));
//TODO: Check is nursery
if (1 == 1) {
actions.add(ActionType(
plot_action_nursery,
EditActionNurseryScreen(
cropId: widget.cropId,
)));
} else {
actions.add(ActionType(
plot_action_plant,
EditActionPlantScreen(
cropId: widget.cropId,
)));
}

actions.add(ActionType( actions.add(ActionType(
plot_action_crop_status, plot_action_crop_status,
null,
EditActionCropStatusScreen( EditActionCropStatusScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_environment_update, plot_action_environment_update,
null,
EditActionEnvironmentUpdate( EditActionEnvironmentUpdate(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_dung, plot_action_dung,
null,
EditActionDungScreen( EditActionDungScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_spraying, plot_action_spraying,
null,
EditActionSprayingScreen( EditActionSprayingScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_disease, plot_action_disease,
null,
EditActionDiseaseScreen( EditActionDiseaseScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_use_water, plot_action_use_water,
null,
EditActionUseWaterScreen( EditActionUseWaterScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_other, plot_action_other,
null,
EditActionOtherScreen( EditActionOtherScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_harvest, plot_action_harvest,
null,
EditActionHarvestScreen( EditActionHarvestScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
actions.add(ActionType( actions.add(ActionType(
plot_action_finish, plot_action_finish,
null,
EditActionEndScreen( EditActionEndScreen(
cropId: widget.cropId, cropId: widget.cropId,
))); )));
}); });
}, },
child: Container( child: Container(
height: 75,
margin: EdgeInsets.all(4.0),
padding: EdgeInsets.all(0.0),
margin: EdgeInsets.all(2.5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: COLOR_CONST.WHITE, color: COLOR_CONST.WHITE,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8.0),
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0),
topRight: Radius.circular(8.0)),
borderRadius: BorderRadius.all(Radius.circular(4.0)),
boxShadow: <BoxShadow>[ boxShadow: <BoxShadow>[
BoxShadow( BoxShadow(
color: COLOR_CONST.GRAY1.withOpacity(0.2), color: COLOR_CONST.GRAY1.withOpacity(0.2),
offset: Offset(1.1, 1.1), offset: Offset(1.1, 1.1),
blurRadius: 10.0),
],
),
child: Stack(
children: <Widget>[
Positioned(
top: -10,
right: -3,
child: (actionType.addScreen == null)
? Container()
: IconButton(
icon: Icon(
Icons.add_circle,
size: 40,
color: Colors.green,
),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => actionType.addScreen));
})),
Positioned.fill(
child: Align(
alignment: Alignment.center,
child: Text(
actionType.actionName,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 13,
color: COLOR_CONST.BLACK2,
),
)),
),
blurRadius: 4.0),
], ],
), ),
child: Align(
alignment: Alignment.center,
child: Text(
actionType.actionName,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 11,
color: COLOR_CONST.BLACK2,
),
)),
)), )),
); );
} }


bool _showTitle(BuildContext context) { bool _showTitle(BuildContext context) {
var kExpandedHeight = MediaQuery.of(context).size.width * 1.125 + 32;
var kExpandedHeight = MediaQuery.of(context).size.width * 0.625 + 24;
return _scrollController.hasClients && return _scrollController.hasClients &&
_scrollController.offset > kExpandedHeight - kToolbarHeight; _scrollController.offset > kExpandedHeight - kToolbarHeight;
} }
leading: Container(), leading: Container(),
title: null, title: null,
// title: _showTitle(context) ? Text(plot_detail_title) : null, // title: _showTitle(context) ? Text(plot_detail_title) : null,
//Height flexibleSpace : WidthScreen /2 * 6/16 * 6(row) + 8(space) *4
expandedHeight: MediaQuery.of(context).size.width * 1.125 + 32,
//Height flexibleSpace : WidthScreen /2 * 4/16 * 5(row) + 8(space) *3
expandedHeight: MediaQuery.of(context).size.width * 0.625 + 24,
flexibleSpace: _showTitle(context) flexibleSpace: _showTitle(context)
? null ? null
: BlocProvider<PlotDetailBloc>( : BlocProvider<PlotDetailBloc>(
title: GridView.count( title: GridView.count(
shrinkWrap: true, shrinkWrap: true,
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: 16 / 6,
childAspectRatio: 16 / 4,
children: actions.map( children: actions.map(
(item) { (item) {
return _createActionButtons(item, contextB); return _createActionButtons(item, contextB);
} }


class ActionType { class ActionType {
Widget addScreen;
Widget listScreen; Widget listScreen;
String actionName; String actionName;
ActionType(String actionName, Widget addScreen, Widget listScreen) {
ActionType(String actionName, Widget listScreen) {
this.actionName = actionName; this.actionName = actionName;
this.addScreen = addScreen;
this.listScreen = listScreen; this.listScreen = listScreen;
} }
} }

Loading…
Cancel
Save