💄 Optimize check in
This commit is contained in:
@@ -100,15 +100,14 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
return Card(
|
||||
margin:
|
||||
margin ?? EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 8,
|
||||
spacing: 6,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@@ -127,11 +126,31 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
Text(DateFormat('MM/dd').format(DateTime.now()))
|
||||
.fontSize(12)
|
||||
.fontSize(16)
|
||||
.textColor(
|
||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
)
|
||||
.padding(top: 2),
|
||||
),
|
||||
Expanded(
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: todayResult.when(
|
||||
data: (result) {
|
||||
return Text(
|
||||
result == null
|
||||
? 'checkInNone'
|
||||
: 'checkInResultLevel${result.level}',
|
||||
textAlign: TextAlign.start,
|
||||
).tr().fontSize(15).bold();
|
||||
},
|
||||
loading:
|
||||
() =>
|
||||
Text('checkInNone').tr().fontSize(15).bold(),
|
||||
error:
|
||||
(err, stack) =>
|
||||
Text('error').tr().fontSize(15).bold(),
|
||||
),
|
||||
).alignment(Alignment.centerLeft),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
@@ -140,6 +159,7 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
Text('notableDayNext')
|
||||
.tr(args: [nextNotableDay.value?.localName ?? 'idk'])
|
||||
.fontSize(12),
|
||||
if (nextNotableDay.value != null)
|
||||
SlideCountdown(
|
||||
decoration: const BoxDecoration(),
|
||||
style: const TextStyle(fontSize: 12),
|
||||
@@ -151,24 +171,17 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 16, top: 8),
|
||||
const Divider(height: 1),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AnimatedSwitcher(
|
||||
const Gap(6),
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: todayResult.when(
|
||||
data: (result) {
|
||||
if (result == null) return _CheckInNoneWidget();
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'checkInResultLevel${result.level}',
|
||||
).tr().fontSize(15).bold(),
|
||||
Wrap(
|
||||
if (result == null) {
|
||||
return Text('checkInNoneHint').tr().fontSize(11);
|
||||
}
|
||||
return Wrap(
|
||||
alignment: WrapAlignment.start,
|
||||
runAlignment: WrapAlignment.start,
|
||||
children:
|
||||
result.tips
|
||||
.map((e) {
|
||||
@@ -195,11 +208,9 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
)
|
||||
.toList()
|
||||
..removeLast(),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
loading: () => _CheckInNoneWidget(),
|
||||
loading: () => Text('checkInNoneHint').tr().fontSize(11),
|
||||
error:
|
||||
(err, stack) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -209,6 +220,8 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
).alignment(Alignment.centerLeft),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton.outlined(
|
||||
@@ -238,24 +251,7 @@ class CheckInWidget extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 16, bottom: 12, top: 4),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CheckInNoneWidget extends StatelessWidget {
|
||||
const _CheckInNoneWidget();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text('checkInNone').tr().fontSize(15).bold(),
|
||||
Text('checkInNoneHint').tr().fontSize(11),
|
||||
],
|
||||
).padding(horizontal: 16, vertical: 12),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user