diamond_notched_fab 0.0.1
diamond_notched_fab: ^0.0.1 copied to clipboard

A simple package for adding a Diamond Shaped Floating Action Button with triangular notched in buttom app bar.

example/lib/main.dart

import 'package:diamond_notched_fab/diamond_fab_notched_shape.dart';
import 'package:diamond_notched_fab/diamond_notched_fab.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Diamond Fab'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: DiamondNotchedFab(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        backgroundColor: Colors.greenAccent,
        child: Icon(Icons.add),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      bottomNavigationBar: BottomAppBar(
        notchMargin: 8,
        shape: DiamondFabNotchedShape(),
        color: Colors.indigo,
        child: Container(
          height: 60.0,
        ),
      ),
    );
  }
}
6
likes
95
pub points
67%
popularity

A simple package for adding a Diamond Shaped Floating Action Button with triangular notched in buttom app bar.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

jaypatel.patel53@gmail.com

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on diamond_notched_fab