flat_3d_button 1.0.0 copy "flat_3d_button: ^1.0.0" to clipboard
flat_3d_button: ^1.0.0 copied to clipboard

outdated

A simple 3D flat button with click animation!

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flat_3d_button/flat_3d_button.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: 'Flat 3D Button Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flat 3D Button Demo Home Page'),
    );
  }
}

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> {
  int _counter = 0;

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

  void _decrementCounter() {
    setState(() {
      _counter--;
    });
  }

  void _resetCounter() {
    setState(() {
      _counter = 0;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
            const SizedBox(
              height: 10,
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Flat3dButton.icon(
                  color: Colors.red,
                  onPressed: _decrementCounter,
                  icon: Icons.remove,
                ),
                const SizedBox(width: 10),
                Flat3dButton.text(
                  onPressed: _resetCounter,
                  text: 'reset',
                ),
                const SizedBox(width: 10),
                Flat3dButton.icon(
                  color: Colors.green,
                  onPressed: _incrementCounter,
                  icon: Icons.add,
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}
35
likes
0
pub points
79%
popularity

Publisher

verified publisherrijfas.tech

A simple 3D flat button with click animation!

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flat_3d_button