realtime_battery_indicator 1.0.0 realtime_battery_indicator: ^1.0.0 copied to clipboard
A realtime good looking customizable battery indicator for all platforms.
import 'package:realtime_battery_indicator/realtime_battery_indicator.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Column(
children: [
SizedBox(height: 20),
Text(
'Realtime Battery Indicator',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 180),
Text(
'With Battery Level',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
BatteryIndicator(),
],
),
SizedBox(height: 20),
Text(
'Without Battery Level',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
BatteryIndicator(
showBatteryLevel: false,
),
],
),
],
),
);
}
}