Browse Source

fix scroll list action

master
daivph 5 years ago
parent
commit
22e0483874
3 changed files with 42 additions and 11 deletions
  1. +1
    -1
      ios/Flutter/.last_build_id
  2. +40
    -9
      lib/presentation/screens/plot_detail/sc_plot_action.dart
  3. +1
    -1
      pubspec.yaml

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

440505e9ea1eee7043d2cbfeb318f6bc
dab672e712362fdbbfa98386624f95d6

+ 40
- 9
lib/presentation/screens/plot_detail/sc_plot_action.dart View File



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(

+ 1
- 1
pubspec.yaml View File

description: A new Flutter project. description: A new Flutter project.


publish_to: 'none' publish_to: 'none'
version: 0.3.0+1
version: 0.5.0+1


environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save