sheet 0.0.3+4 copy "sheet: ^0.0.3+4" to clipboard
sheet: ^0.0.3+4 copied to clipboard

outdated

A new Flutter package project.

example/lib/main.dart

import 'package:example/examples/bouncing_sheet.dart';
import 'package:example/examples/fit_resizable_sheet.dart';
import 'package:example/examples/fit_sheet.dart';
import 'package:example/examples/floating_sheet.dart';
import 'package:example/examples/resizable_sheet.dart';
import 'package:example/examples/scrollable_sheet.dart';
import 'package:example/examples/simple_sheet.dart';
import 'package:example/examples/snap_sheet.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sheet/sheet.dart';

import 'examples/clamped_sheet.dart';
import 'examples/complex_snap_sheet.dart';
import 'examples/fit_sheet_snap.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(platform: TargetPlatform.iOS),
      title: 'BottomSheet Modals',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Material(
      child: Scaffold(
        body: CupertinoPageScaffold(
          backgroundColor: Colors.white,
          child: SizedBox.expand(
            child: SingleChildScrollView(
              primary: true,
              child: SafeArea(
                bottom: false,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.stretch,
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    const SectionTitle('SHEET'),
                    ListTile(
                      title: const Text('Simple sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => SimpleSheetPage(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Snap sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => SnapSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Fit sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => FitSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Floating sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => FloatingSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Clamped sheet (min and max extent)'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => ClampedSheetPage(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Sheet with Bouncing at top'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => BouncingSheetPage(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Fit Snap sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => FitSnapSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Resizable sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => ResizableSheetExample(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Fit Resizable Bouncing sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => FitResizableSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Scrollabe Sheet'),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => ScrollableSheet(),
                        ),
                      ),
                    ),
                    ListTile(
                      title: const Text('Advanced SnapSheet '),
                      onTap: () => Navigator.of(context).push(
                        MaterialPageRoute<void>(
                          builder: (BuildContext context) => AdvancedSnapSheetPageExample(),
                        ),
                      ),
                    ),
                    SizedBox(height: 60)
                  ],
                ),
              ),
            ),
          ),
          navigationBar: CupertinoNavigationBar(
            transitionBetweenRoutes: false,
            middle: Text('Sheets'),
          ),
        ),
      ),
    );
  }
}

class SectionTitle extends StatelessWidget {
  final String title;

  // ignore: sort_constructors_first
  const SectionTitle(
    this.title, {
    Key? key,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.fromLTRB(16, 20, 16, 8),
      child: Text(
        title,
        style: Theme.of(context).textTheme.caption,
      ),
    );
  }
}

extension ListUtils<T> on List<T> {
  List<T> addItemInBetween(T item) => length <= 1
      ? this
      : sublist(1).fold(
          <T>[first],
          (r, element) => [...r, item, element],
        );
}
80
likes
0
pub points
92%
popularity

Publisher

unverified uploader

A new Flutter package project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on sheet