Added progress indicator top items

This commit is contained in:
Juan Gilsanz Polo 2022-10-25 20:02:48 +02:00
parent 53113735c8
commit bbf4041002
4 changed files with 36 additions and 5 deletions

View file

@ -38,6 +38,7 @@ This is an unofficial application. The AdGuard Home team and the development of
- [flutter web browser](https://pub.dev/packages/flutter_web_browser) - [flutter web browser](https://pub.dev/packages/flutter_web_browser)
- [flutter svg](https://pub.dev/packages/flutter_svg) - [flutter svg](https://pub.dev/packages/flutter_svg)
- [bottom sheet](https://pub.dev/packages/bottom_sheet) - [bottom sheet](https://pub.dev/packages/bottom_sheet)
- [percent indicator](https://pub.dev/packages/percent_indicator)
<br> <br>

View file

@ -3,6 +3,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:percent_indicator/percent_indicator.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -154,11 +155,32 @@ class _TopItemsScreenState extends State<TopItemsScreen> {
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
], ],
Text( Row(
"${doubleFormat((screenData[index].values.toList()[0]/total*100), Platform.localeName)}%", children: [
style: TextStyle( SizedBox(
color: Theme.of(context).listTileTheme.iconColor width: 50,
), child: Text(
"${doubleFormat((screenData[index].values.toList()[0]/total*100), Platform.localeName)}%",
style: TextStyle(
color: Theme.of(context).listTileTheme.iconColor
),
),
),
const SizedBox(width: 10),
Flexible(
child: LinearPercentIndicator(
animation: true,
lineHeight: 4,
animationDuration: 500,
curve: Curves.easeOut,
percent: screenData[index].values.toList()[0]/total,
barRadius: const Radius.circular(5),
progressColor: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.15),
),
),
const SizedBox(width: 10),
],
), ),
], ],
) )

View file

@ -406,6 +406,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
percent_indicator:
dependency: "direct main"
description:
name: percent_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.2"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:

View file

@ -48,6 +48,7 @@ dependencies:
flutter_web_browser: ^0.17.1 flutter_web_browser: ^0.17.1
flutter_svg: ^1.1.5 flutter_svg: ^1.1.5
bottom_sheet: ^3.1.2 bottom_sheet: ^3.1.2
percent_indicator: ^4.2.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: