✨ User experience & level
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:solian/models/account.dart';
|
||||
import 'package:solian/models/account_status.dart';
|
||||
import 'package:solian/platform.dart';
|
||||
import 'package:solian/providers/account_status.dart';
|
||||
import 'package:solian/providers/experience.dart';
|
||||
import 'package:solian/widgets/account/account_avatar.dart';
|
||||
import 'package:solian/widgets/account/account_badge.dart';
|
||||
import 'package:solian/widgets/account/account_status_action.dart';
|
||||
@ -18,6 +20,7 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
final String nick;
|
||||
final String? desc;
|
||||
final Account? detail;
|
||||
final AccountProfile? profile;
|
||||
final List<AccountBadge>? badges;
|
||||
final List<Widget>? extraWidgets;
|
||||
|
||||
@ -33,6 +36,7 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
required this.desc,
|
||||
required this.badges,
|
||||
this.detail,
|
||||
this.profile,
|
||||
this.status,
|
||||
this.extraWidgets,
|
||||
this.onEditStatus,
|
||||
@ -130,7 +134,10 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(info.$3),
|
||||
Text(
|
||||
info.$3,
|
||||
style: const TextStyle(height: 1),
|
||||
).paddingOnly(bottom: 3),
|
||||
if (!status.isOnline && status.lastSeenAt != null)
|
||||
Opacity(
|
||||
opacity: 0.75,
|
||||
@ -182,6 +189,63 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
if (profile != null)
|
||||
Card(
|
||||
child: ListTile(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -4, vertical: -2),
|
||||
title: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
ExperienceProvider.getLevelFromExp(
|
||||
profile!.experience ?? 0,
|
||||
).$2.tr,
|
||||
),
|
||||
const Gap(4),
|
||||
Badge(
|
||||
label: Text(
|
||||
'Lv${ExperienceProvider.getLevelFromExp(
|
||||
profile!.experience ?? 0,
|
||||
).$1}',
|
||||
style: GoogleFonts.dosis(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
).paddingOnly(top: 1),
|
||||
],
|
||||
),
|
||||
subtitle: SizedBox(
|
||||
height: 20,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(8),
|
||||
),
|
||||
value: ExperienceProvider.calcLevelUpProgress(
|
||||
profile!.experience ?? 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
Text(
|
||||
'${ExperienceProvider.calcLevelUpProgressLevel(profile!.experience ?? 0)} EXP',
|
||||
style: GoogleFonts.robotoMono(
|
||||
fontSize: 10,
|
||||
height: 0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
|
@ -99,6 +99,7 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||
nick: _userinfo!.nick,
|
||||
desc: _userinfo!.description,
|
||||
detail: _userinfo!,
|
||||
profile: _userinfo!.profile,
|
||||
badges: _userinfo!.badges,
|
||||
status:
|
||||
Get.find<StatusProvider>().getSomeoneStatus(_userinfo!.name),
|
||||
|
@ -347,8 +347,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
||||
FutureBuilder(
|
||||
future: element.file.length(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData)
|
||||
if (!snapshot.hasData) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Text(
|
||||
_formatBytes(snapshot.data!),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
|
@ -131,7 +131,7 @@ class DailySignHistoryChartDialog extends StatelessWidget {
|
||||
reservedSize: 28,
|
||||
interval: 86400000,
|
||||
getTitlesWidget: (value, _) => Text(
|
||||
DateFormat('MM/dd').format(
|
||||
DateFormat('dd').format(
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
value.toInt(),
|
||||
),
|
||||
@ -231,7 +231,7 @@ class DailySignHistoryChartDialog extends StatelessWidget {
|
||||
reservedSize: 28,
|
||||
interval: 86400000,
|
||||
getTitlesWidget: (value, _) => Text(
|
||||
DateFormat('MM/dd').format(
|
||||
DateFormat('dd').format(
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
value.toInt(),
|
||||
),
|
||||
|
Reference in New Issue
Block a user