bottom_sheet_draggable 1.0.3+1 copy "bottom_sheet_draggable: ^1.0.3+1" to clipboard
bottom_sheet_draggable: ^1.0.3+1 copied to clipboard

A flutter lib support bottom sheet and sticky header

example/lib/main.dart

import 'package:asuka/asuka.dart';
import 'package:bottom_sheet_draggable/bottom_sheet_draggable.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      builder: Asuka.builder,
      navigatorObservers: [Asuka.asukaHeroController],
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      title: 'Flutter Demo',
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Bottom Sheet Draggable'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            BottomSheetDraggable.show(
              context: context,
              appbar: _buildAppbar(context),
              builder: (context, controller) {
                return _buildModal();
              },
            );
          },
          child: const Text('Click me!'),
        ),
      ),
    );
  }

  Container _buildAppbar(BuildContext context) {
    return Container(
      color: Colors.blue,
      child: Column(
        children: [
          Expanded(
            child: Container(),
          ),
          // this will be you container
          AppBar(
            title: const Text('Bottom Sheet Draggable'),
            actions: [_closeButton(context)],
          ),
        ],
      ),
    );
  }

  Widget _buildModal() {
    return Column(
      children: List.generate(
        10,
        (index) => ListTile(
          title: Text('Item: $index'),
        ),
      ),
    );
  }

  Widget _closeButton(BuildContext context) {
    return Transform.scale(
      scale: 1,
      child: IconButton(
        onPressed: () => Navigator.of(context).pop(),
        icon: const Icon(Icons.close),
        padding: const EdgeInsets.only(bottom: 4.0, right: 4.0),
      ),
    );
  }
}
6
likes
140
points
1
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A flutter lib support bottom sheet and sticky header

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on bottom_sheet_draggable