presentScrollView<T> static method

void presentScrollView<T>({
  1. String title = "Popup",
  2. bool isFullScreen = true,
  3. ScrollPhysics? physics,
  4. dynamic onChanged(
    1. T result
    )?,
  5. required BuildContext context,
  6. required List<Widget> slivers,
})

Implementation

static void presentScrollView<T>({
  String title = "Popup",
  bool isFullScreen = true,
  ScrollPhysics? physics,
  Function(T result)? onChanged,
  required BuildContext context,
  required List<Widget> slivers,
}) async {
  final result = await showModalBottomSheet<T>(
      context: context,
      useSafeArea: true,
      isScrollControlled: isFullScreen,
      builder: (BuildContext context) {
        return SafeArea(
          child: LayoutBuilder(builder: (context, constraints) {
            return Column(
              children: [
                AppBar(
                  title: Padding(
                    padding: const EdgeInsets.all(0),
                    child: Text(
                      title,
                      style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
                    ),
                  ),
                  automaticallyImplyLeading: false,
                  actions: [
                    IconButton(
                        onPressed: () {
                          Navigator.of(context).pop();
                        },
                        icon: const Icon(Icons.close))
                  ],
                ),
                Expanded(
                  child: CustomScrollView(
                    physics: physics,
                    // slivers: <Widget>[
                    //   SliverToBoxAdapter(
                    //     child: builder,
                    //   ),
                    // ],

                    slivers: slivers,
                  ),
                ),
              ],
            );
          }),
        );
      });
  if (result != null && onChanged != null) {
    onChanged(result);
  }
}