import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_ring_indicator/ring_indicator.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const FittedBox( fit: BoxFit.fitWidth, child: SizedBox( width: 720, height: 1080, child: MyHomePage(title: 'Flutter Demo Home Page'), ), ), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { double value = 0; void _incrementCounter() { setState(() { value = Random().nextDouble() * 100; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox.square( dimension: 100, child: RingIndicator( ringColor: Colors.deepPurpleAccent, startAngel: pi * -0.7, endAngel: pi * 0.7, maxValue: 100, value: value, labelBuilder: (value) => Center( child: Text( value.toStringAsFixed(1), style: const TextStyle(color: Colors.teal, fontSize: 24), )), ), ), Text( '$value', style: Theme.of(context).textTheme.headline4, ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add), ), ); } }