fix: fix white box error and add opacity variation to construct levels in progress bar (#4966)
This commit is contained in:
parent
cd131e0ec2
commit
061b667b8b
3 changed files with 44 additions and 44 deletions
|
|
@ -27,36 +27,42 @@ class ConstructXPProgressBar extends StatelessWidget {
|
|||
|
||||
final analyticsService = Matrix.of(context).analyticsDataService;
|
||||
|
||||
return Column(
|
||||
spacing: 8.0,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [...categories.map((c) => c.icon())],
|
||||
),
|
||||
StreamBuilder(
|
||||
stream:
|
||||
analyticsService.updateDispatcher.constructUpdateStream.stream,
|
||||
return StreamBuilder(
|
||||
stream: analyticsService.updateDispatcher.constructUpdateStream.stream,
|
||||
builder: (context, snapshot) {
|
||||
return FutureBuilder(
|
||||
future: analyticsService.getConstructUse(construct),
|
||||
builder: (context, snapshot) {
|
||||
return FutureBuilder(
|
||||
future: analyticsService.getConstructUse(construct),
|
||||
builder: (context, snapshot) {
|
||||
final points = snapshot.data?.points ?? 0;
|
||||
final progress =
|
||||
min(1.0, points / AnalyticsConstants.xpForFlower);
|
||||
|
||||
return AnimatedProgressBar(
|
||||
final points = snapshot.data?.points ?? 0;
|
||||
final progress = min(1.0, points / AnalyticsConstants.xpForFlower);
|
||||
final level =
|
||||
snapshot.data?.constructLevel ?? ConstructLevelEnum.seeds;
|
||||
return Column(
|
||||
spacing: 8.0,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
...categories.map(
|
||||
(c) => Opacity(
|
||||
opacity: level == c ? 1.0 : 0.4,
|
||||
child: c.icon(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
AnimatedProgressBar(
|
||||
height: 20.0,
|
||||
widthPercent: progress,
|
||||
barColor: AppConfig.goldLight,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,20 +69,18 @@ class LemmaUsageDots extends StatelessWidget {
|
|||
color: textColor.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
title: Flexible(
|
||||
child: dots.isEmpty
|
||||
? Text(
|
||||
L10n.of(context).noDataFound,
|
||||
style: const TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
)
|
||||
: Wrap(
|
||||
spacing: 3,
|
||||
runSpacing: 5,
|
||||
children: dots,
|
||||
title: dots.isEmpty
|
||||
? Text(
|
||||
L10n.of(context).noDataFound,
|
||||
style: const TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Wrap(
|
||||
spacing: 3,
|
||||
runSpacing: 5,
|
||||
children: dots,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,15 +116,11 @@ class ConstructUses {
|
|||
}
|
||||
}
|
||||
|
||||
ConstructLevelEnum get constructLevel {
|
||||
if (points < 30) {
|
||||
return ConstructLevelEnum.seeds;
|
||||
} else if (points < 100) {
|
||||
return ConstructLevelEnum.greens;
|
||||
} else {
|
||||
return ConstructLevelEnum.flowers;
|
||||
}
|
||||
}
|
||||
ConstructLevelEnum get constructLevel => switch (points) {
|
||||
< AnalyticsConstants.xpForGreens => ConstructLevelEnum.seeds,
|
||||
< AnalyticsConstants.xpForFlower => ConstructLevelEnum.greens,
|
||||
_ => ConstructLevelEnum.flowers,
|
||||
};
|
||||
|
||||
void merge(ConstructUses other) {
|
||||
if (other.lemma.toLowerCase() != lemma.toLowerCase() ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue