icon_bottomsheet 0.0.3 copy "icon_bottomsheet: ^0.0.3" to clipboard
icon_bottomsheet: ^0.0.3 copied to clipboard

A customized bottomsheet with dynamic icon(widget) on top. It gives a transparent background to the iconWidget which is displayed above the bottomsheet. The iconWidget is a dynamic widget and can be c [...]

example/lib/main.dart

import 'package:example/kid.dart';
import 'package:example/payment_failed.dart';
import 'package:example/payment_success.dart';
import 'package:example/success.dart';
import 'package:flutter/material.dart';
import 'package:icon_bottomsheet/icon_bottomsheet.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
        canvasColor: Colors.transparent,
      ),
      home: const MyHomePage(title: 'Icon BottomSheet'),
    );
  }
}

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

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  void _showBottomSheet() {
    showModalBottomSheet<int>(
      context: context,
      builder: (context) {
        return const IconBottomSheet(
          iconWidget: Icon(
            Icons.cancel_outlined,
            color: Colors.redAccent,
            size: 100,
          ),
          position: Position.right,
          iconShape: IconShape.circle,
          iconSize: 120,
          iconPadding: 20,
          child: Success(),
        );
      },
    );
  }

  void _showKidsBottomSheet() {
    showModalBottomSheet<int>(
      context: context,
      builder: (context) {
        return IconBottomSheet(
          iconWidget: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Image.asset('assets/duckling.png'),
          ),
          //iconBackgroundColor: Colors.transparent,
          //childBackgroundColor: Colors.blue,
          iconShape: IconShape.circle,
          iconSize: 120,
          iconPadding: 20,
          child: const Kid(),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            const SizedBox(
              height: 20,
            ),
            ElevatedButton(
              onPressed: _showBottomSheet,
              child: const Text(
                'Show BottomSheet',
              ),
            )
          ],
        ),
      ),
    );
  }
}
12
likes
140
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A customized bottomsheet with dynamic icon(widget) on top. It gives a transparent background to the iconWidget which is displayed above the bottomsheet. The iconWidget is a dynamic widget and can be customized by the user. It can also be positioned as left, center or right. The background colors of the iconWidget as well as the child can be customized. The idea behind the icon_bottomsheet is to give user a bottomsheet with a customizable widget with a transparent border above it.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on icon_bottomsheet