cake_wallet/lib/src/widgets/scollable_with_bottom_section.dart

51 lines
1.6 KiB
Dart
Raw Normal View History

2020-01-04 19:31:52 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ScrollableWithBottomSection extends StatefulWidget {
ScrollableWithBottomSection(
2022-10-12 17:09:57 +00:00
{required this.content,
required this.bottomSection,
2020-01-04 19:31:52 +00:00
this.contentPadding,
this.bottomSectionPadding});
2020-01-08 12:26:34 +00:00
final Widget content;
final Widget bottomSection;
2022-10-12 17:09:57 +00:00
final EdgeInsets? contentPadding;
final EdgeInsets? bottomSectionPadding;
2020-01-08 12:26:34 +00:00
2020-01-04 19:31:52 +00:00
@override
ScrollableWithBottomSectionState createState() =>
ScrollableWithBottomSectionState();
}
class ScrollableWithBottomSectionState
extends State<ScrollableWithBottomSection> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
return SingleChildScrollView(
// physics:
// const AlwaysScrollableScrollPhysics(), // const NeverScrollableScrollPhysics(), //
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.heightConstraints().maxHeight),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: widget.contentPadding ??
EdgeInsets.only(left: 20, right: 20),
child: widget.content,
),
Padding(
padding: widget.bottomSectionPadding ??
EdgeInsets.only(bottom: 20, right: 20, left: 20),
child: widget.bottomSection)
],
),
),
);
});
}
}