|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool _showTitle(BuildContext context) { |
|
|
bool _showTitle(BuildContext context) { |
|
|
var kExpandedHeight = MediaQuery.of(context).size.width * 0.625 + 24; |
|
|
var kExpandedHeight = MediaQuery.of(context).size.width * 0.625 + 24; |
|
|
// print("height: $kExpandedHeight"); |
|
|
|
|
|
// print('offset ${_scrollController.offset}'); |
|
|
|
|
|
return _scrollController.hasClients && |
|
|
return _scrollController.hasClients && |
|
|
_scrollController.offset > kExpandedHeight - kToolbarHeight; |
|
|
_scrollController.offset > kExpandedHeight - kToolbarHeight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
child: HoldInfinityWidget( |
|
|
child: HoldInfinityWidget( |
|
|
cropId: widget.cropId, |
|
|
cropId: widget.cropId, |
|
|
cropCode: widget.cropCode, |
|
|
cropCode: widget.cropCode, |
|
|
|
|
|
parentScroll: _scrollController, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
class HoldInfinityWidget extends StatelessWidget { |
|
|
class HoldInfinityWidget extends StatelessWidget { |
|
|
int cropId; |
|
|
int cropId; |
|
|
String cropCode; |
|
|
String cropCode; |
|
|
HoldInfinityWidget({this.cropId, this.cropCode}); |
|
|
|
|
|
|
|
|
ScrollController parentScroll; |
|
|
|
|
|
HoldInfinityWidget({this.cropId, this.cropCode, @required this.parentScroll}); |
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); |
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); |
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
return Scaffold(key: _scaffoldKey, body: InfinityView(cropId: cropId)); |
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
|
|
key: _scaffoldKey, |
|
|
|
|
|
body: InfinityView( |
|
|
|
|
|
cropId: cropId, |
|
|
|
|
|
parentScroll: parentScroll, |
|
|
|
|
|
)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class InfinityView extends StatefulWidget { |
|
|
class InfinityView extends StatefulWidget { |
|
|
int cropId; |
|
|
int cropId; |
|
|
String cropCode; |
|
|
String cropCode; |
|
|
InfinityView({this.cropId, this.cropCode}); |
|
|
|
|
|
|
|
|
ScrollController parentScroll; |
|
|
|
|
|
InfinityView({this.cropId, this.cropCode, @required this.parentScroll}); |
|
|
@override |
|
|
@override |
|
|
_InfinityViewState createState() => _InfinityViewState(); |
|
|
_InfinityViewState createState() => _InfinityViewState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
final _scrollThreshold = 250.0; |
|
|
final _scrollThreshold = 250.0; |
|
|
PlotDetailBloc _plotDetailBloc; |
|
|
PlotDetailBloc _plotDetailBloc; |
|
|
var a = Get.put(ChangeToRefreshLists()); |
|
|
var a = Get.put(ChangeToRefreshLists()); |
|
|
|
|
|
var heightOfActionButton = Get.width * 0.625 + 24; |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
void initState() { |
|
|
void initState() { |
|
|
|
|
|
|
|
|
bottom: BorderSide( |
|
|
bottom: BorderSide( |
|
|
width: 0.5, color: COLOR_CONST.DEFAULT)), |
|
|
width: 0.5, color: COLOR_CONST.DEFAULT)), |
|
|
), |
|
|
), |
|
|
child: Text( |
|
|
|
|
|
plot_detail_title, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 20, fontWeight: FontWeight.normal), |
|
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
plot_detail_title, |
|
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 20, fontWeight: FontWeight.normal), |
|
|
|
|
|
)), |
|
|
|
|
|
IconButton( |
|
|
|
|
|
icon: (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) |
|
|
|
|
|
? Icon(Icons.arrow_upward) |
|
|
|
|
|
: Icon(Icons.arrow_downward), |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
if (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) { |
|
|
|
|
|
widget.parentScroll.animateTo( |
|
|
|
|
|
heightOfActionButton, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} else { |
|
|
|
|
|
widget.parentScroll.animateTo(0.0, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
], |
|
|
)), |
|
|
)), |
|
|
Expanded( |
|
|
Expanded( |
|
|
child: ListView.builder( |
|
|
child: ListView.builder( |