Linear Progress
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
double percentage = 0;
void initState() {
Timer.periodic(const Duration(milliseconds: 200), (timer) {
percentage += 5;
setState(() {});
if (percentage == 100) timer.cancel();
});
super.initState();
}
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Downloading',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
Text(
'${percentage.round()}%',
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
],
),
const Gap(8),
LinearProgressIndicator(
color: Colors.green,
minHeight: 30,
value: percentage / 100,
),
],
),