2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class ScrollableWithBottomSection extends StatefulWidget {
|
2024-04-12 12:36:42 +00:00
|
|
|
ScrollableWithBottomSection({
|
|
|
|
required this.content,
|
|
|
|
required this.bottomSection,
|
|
|
|
this.topSection,
|
|
|
|
this.contentPadding,
|
|
|
|
this.bottomSectionPadding,
|
|
|
|
this.topSectionPadding,
|
2024-09-22 02:46:51 +00:00
|
|
|
this.scrollableKey,
|
2024-04-12 12:36:42 +00:00
|
|
|
});
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
final Widget content;
|
|
|
|
final Widget bottomSection;
|
2024-04-12 12:36:42 +00:00
|
|
|
final Widget? topSection;
|
2022-10-12 17:09:57 +00:00
|
|
|
final EdgeInsets? contentPadding;
|
|
|
|
final EdgeInsets? bottomSectionPadding;
|
2024-04-12 12:36:42 +00:00
|
|
|
final EdgeInsets? topSectionPadding;
|
2024-09-22 02:46:51 +00:00
|
|
|
final Key? scrollableKey;
|
2020-01-08 12:26:34 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
@override
|
2024-02-23 17:09:24 +00:00
|
|
|
ScrollableWithBottomSectionState createState() => ScrollableWithBottomSectionState();
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
|
2024-02-23 17:09:24 +00:00
|
|
|
class ScrollableWithBottomSectionState extends State<ScrollableWithBottomSection> {
|
2020-01-04 19:31:52 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-02-23 17:09:24 +00:00
|
|
|
return Column(
|
|
|
|
children: [
|
2024-04-12 12:36:42 +00:00
|
|
|
if (widget.topSection != null)
|
|
|
|
Padding(
|
|
|
|
padding: widget.topSectionPadding?.copyWith(top: 10) ??
|
|
|
|
EdgeInsets.only(top: 10, bottom: 20, right: 20, left: 20),
|
|
|
|
child: widget.topSection,
|
|
|
|
),
|
2024-02-23 17:09:24 +00:00
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
2024-09-22 02:46:51 +00:00
|
|
|
key: widget.scrollableKey,
|
2024-02-23 17:09:24 +00:00
|
|
|
child: Padding(
|
|
|
|
padding: widget.contentPadding ?? EdgeInsets.only(left: 20, right: 20),
|
|
|
|
child: widget.content,
|
|
|
|
),
|
2020-01-04 19:31:52 +00:00
|
|
|
),
|
|
|
|
),
|
2024-02-23 17:09:24 +00:00
|
|
|
Padding(
|
|
|
|
padding: widget.bottomSectionPadding?.copyWith(top: 10) ??
|
|
|
|
EdgeInsets.only(top: 10, bottom: 20, right: 20, left: 20),
|
|
|
|
child: widget.bottomSection,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
}
|