animated_battery_gauge 0.2.0 copy "animated_battery_gauge: ^0.2.0" to clipboard
animated_battery_gauge: ^0.2.0 copied to clipboard

A simple and customizable animated battery gauge widget.

example/lib/main.dart

import 'package:flutter/cupertino.dart';

import 'battery_gauge_demo.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter Demo',
      theme: CupertinoThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primaryColor: CupertinoColors.activeBlue,
      ),
      home: StartWidget(), //MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class StartWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        middle: Text('Animated Battery Demo'),
      ),
      child: Center(
        child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              CupertinoButton(
                onPressed: () {
                  Navigator.of(context)
                      .push(CupertinoPageRoute(builder: (context) {
                    return BatteryGaugeDemo(
                      isHorizontal: true,
                      isGrid: false,
                    );
                  }));
                },
                child: Text('Show Battery Horizontal w/ gauge'),
              ),
              CupertinoButton(
                onPressed: () {
                  Navigator.of(context)
                      .push(CupertinoPageRoute(builder: (context) {
                    return BatteryGaugeDemo(
                      isHorizontal: false,
                      isGrid: false,
                    );
                  }));
                },
                child: Text('Show Battery Vertical w/ gauge'),
              ),
              CupertinoButton(
                onPressed: () {
                  Navigator.of(context)
                      .push(CupertinoPageRoute(builder: (context) {
                    return BatteryGaugeDemo(
                      isHorizontal: true,
                      isGrid: true,
                    );
                  }));
                },
                child: Text('Show Battery Horizontal w/ grid mode'),
              ),
              CupertinoButton(
                onPressed: () {
                  Navigator.of(context)
                      .push(CupertinoPageRoute(builder: (context) {
                    return BatteryGaugeDemo(
                      isHorizontal: false,
                      isGrid: true,
                    );
                  }));
                },
                child: Text('Show Battery Vertical w/ grid mode'),
              ),
            ]),
      ),
    );
  }
}
4
likes
150
points
71
downloads

Publisher

unverified uploader

Weekly Downloads

A simple and customizable animated battery gauge widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on animated_battery_gauge