flutter_grid_button 1.1.0 copy "flutter_grid_button: ^1.1.0" to clipboard
flutter_grid_button: ^1.1.0 copied to clipboard

outdated

Flutter widget that arrange buttons in a grid. It is useful for making a number pad, calculator, and so on.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_grid_button/flutter_grid_button.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    const textStyle = TextStyle(fontSize: 26);
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('GridButton'),
        ),
        body: Builder(builder: (context) {
          return GridButton(
            textStyle: textStyle,
            borderColor: Colors.black,
            onPressed: (String val) {
              Scaffold.of(context).showSnackBar(
                SnackBar(
                  content: Text(val),
                  duration: Duration(milliseconds: 400),
                ),
              );
            },
            items: [
              [
                GridButtonItem(
                    title: "Black",
                    color: Colors.black,
                    textStyle: textStyle.copyWith(color: Colors.white)),
                GridButtonItem(title: "Red", color: Colors.red),
              ],
              [GridButtonItem(title: "Button", value: "100")],
              [
                GridButtonItem(title: "7"),
                GridButtonItem(title: "8"),
                GridButtonItem(title: "9"),
                GridButtonItem(title: "×", color: Colors.grey[300]),
              ],
              [
                GridButtonItem(title: "4"),
                GridButtonItem(title: "5"),
                GridButtonItem(title: "6"),
                GridButtonItem(title: "-", color: Colors.grey[300]),
              ],
              [
                GridButtonItem(title: "1"),
                GridButtonItem(title: "2"),
                GridButtonItem(title: "3"),
                GridButtonItem(title: "+", color: Colors.grey[300]),
              ],
              [
                GridButtonItem(title: "0"),
                GridButtonItem(title: "000", flex: 2),
                GridButtonItem(title: "=", color: Colors.grey[300]),
              ],
            ],
          );
        }),
      ),
    );
  }
}
26
likes
0
pub points
91%
popularity

Publisher

verified publisherzuvola.com

Flutter widget that arrange buttons in a grid. It is useful for making a number pad, calculator, and so on.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_grid_button