💄 More transparency

This commit is contained in:
LittleSheep 2024-10-06 23:06:33 +08:00
parent 2e9c4d166e
commit d7e6fe2d8f
9 changed files with 1019 additions and 1041 deletions

View File

@ -4,7 +4,6 @@ import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:solian/widgets/root_container.dart';
import 'package:solian/widgets/sized_container.dart'; import 'package:solian/widgets/sized_container.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -16,8 +15,7 @@ class AboutScreen extends StatelessWidget {
const denseButtonStyle = const denseButtonStyle =
ButtonStyle(visualDensity: VisualDensity(vertical: -4)); ButtonStyle(visualDensity: VisualDensity(vertical: -4));
return RootContainer( return SizedBox(
child: SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -142,7 +140,6 @@ class AboutScreen extends StatelessWidget {
), ),
], ],
), ),
),
); );
} }
} }

View File

@ -7,7 +7,6 @@ import 'package:solian/providers/account_status.dart';
import 'package:solian/providers/relation.dart'; import 'package:solian/providers/relation.dart';
import 'package:solian/router.dart'; import 'package:solian/router.dart';
import 'package:solian/widgets/account/account_heading.dart'; import 'package:solian/widgets/account/account_heading.dart';
import 'package:solian/widgets/root_container.dart';
import 'package:solian/widgets/sized_container.dart'; import 'package:solian/widgets/sized_container.dart';
import 'package:badges/badges.dart' as badges; import 'package:badges/badges.dart' as badges;
@ -50,8 +49,7 @@ class _AccountScreenState extends State<AccountScreen> {
final AuthProvider auth = Get.find(); final AuthProvider auth = Get.find();
return RootContainer( return SafeArea(
child: SafeArea(
child: Obx(() { child: Obx(() {
if (auth.isAuthorized.isFalse) { if (auth.isAuthorized.isFalse) {
return Center( return Center(
@ -155,7 +153,6 @@ class _AccountScreenState extends State<AccountScreen> {
), ),
); );
}), }),
),
); );
} }
} }

View File

@ -6,7 +6,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:solian/exceptions/request.dart'; import 'package:solian/exceptions/request.dart';
import 'package:solian/exts.dart'; import 'package:solian/exts.dart';
import 'package:solian/providers/auth.dart'; import 'package:solian/providers/auth.dart';
import 'package:solian/widgets/root_container.dart';
class NotificationPreferencesScreen extends StatefulWidget { class NotificationPreferencesScreen extends StatefulWidget {
const NotificationPreferencesScreen({super.key}); const NotificationPreferencesScreen({super.key});
@ -75,8 +74,7 @@ class _NotificationPreferencesScreenState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootContainer( return Column(
child: Column(
children: [ children: [
if (_isBusy) const LinearProgressIndicator().animate().scaleX(), if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
ListTile( ListTile(
@ -112,7 +110,6 @@ class _NotificationPreferencesScreenState
), ),
), ),
], ],
),
); );
} }
} }

View File

@ -187,8 +187,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
const double padding = 32; const double padding = 32;
return RootContainer( return ListView(
child: ListView(
children: [ children: [
if (_isBusy) const LinearProgressIndicator().animate().scaleX(), if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
const Gap(24), const Gap(24),
@ -343,7 +342,6 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
], ],
).paddingSymmetric(horizontal: padding), ).paddingSymmetric(horizontal: padding),
], ],
),
); );
} }

View File

@ -217,8 +217,7 @@ class _SignInScreenState extends State<SignInScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootContainer( return CenteredContainer(
child: CenteredContainer(
maxWidth: 360, maxWidth: 360,
child: Theme( child: Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent), data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
@ -243,10 +242,9 @@ class _SignInScreenState extends State<SignInScreen> {
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius: const BorderRadius.all(Radius.circular(8)),
const BorderRadius.all(Radius.circular(8)), child:
child: Image.asset('assets/logo.png', Image.asset('assets/logo.png', width: 64, height: 64),
width: 64, height: 64),
).paddingOnly(bottom: 8, left: 4), ).paddingOnly(bottom: 8, left: 4),
), ),
Text( Text(
@ -272,8 +270,7 @@ class _SignInScreenState extends State<SignInScreen> {
Icons.question_mark, Icons.question_mark,
), ),
title: Text( title: Text(
_factorLabelMap[x.type]?.$1 ?? _factorLabelMap[x.type]?.$1 ?? 'unknown'.tr,
'unknown'.tr,
), ),
enabled: !_currentTicket!.factorTrail enabled: !_currentTicket!.factorTrail
.contains(x.id), .contains(x.id),
@ -303,8 +300,8 @@ class _SignInScreenState extends State<SignInScreen> {
onPressed: (_isBusy || _period > 1) onPressed: (_isBusy || _period > 1)
? null ? null
: () => _previousStep(), : () => _previousStep(),
style: TextButton.styleFrom( style:
foregroundColor: Colors.grey), TextButton.styleFrom(foregroundColor: Colors.grey),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -335,10 +332,9 @@ class _SignInScreenState extends State<SignInScreen> {
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius: const BorderRadius.all(Radius.circular(8)),
const BorderRadius.all(Radius.circular(8)), child:
child: Image.asset('assets/logo.png', Image.asset('assets/logo.png', width: 64, height: 64),
width: 64, height: 64),
).paddingOnly(bottom: 8, left: 4), ).paddingOnly(bottom: 8, left: 4),
), ),
Text( Text(
@ -372,8 +368,7 @@ class _SignInScreenState extends State<SignInScreen> {
), ),
onTapOutside: (_) => onTapOutside: (_) =>
FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
onSubmitted: onSubmitted: _isBusy ? null : (_) => _performCheckTicket(),
_isBusy ? null : (_) => _performCheckTicket(),
), ),
const Gap(12), const Gap(12),
Row( Row(
@ -381,8 +376,8 @@ class _SignInScreenState extends State<SignInScreen> {
children: [ children: [
TextButton( TextButton(
onPressed: _isBusy ? null : () => _previousStep(), onPressed: _isBusy ? null : () => _previousStep(),
style: TextButton.styleFrom( style:
foregroundColor: Colors.grey), TextButton.styleFrom(foregroundColor: Colors.grey),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -392,8 +387,7 @@ class _SignInScreenState extends State<SignInScreen> {
), ),
), ),
TextButton( TextButton(
onPressed: onPressed: _isBusy ? null : () => _performCheckTicket(),
_isBusy ? null : () => _performCheckTicket(),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -413,10 +407,9 @@ class _SignInScreenState extends State<SignInScreen> {
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius: const BorderRadius.all(Radius.circular(8)),
const BorderRadius.all(Radius.circular(8)), child:
child: Image.asset('assets/logo.png', Image.asset('assets/logo.png', width: 64, height: 64),
width: 64, height: 64),
).paddingOnly(bottom: 8, left: 4), ).paddingOnly(bottom: 8, left: 4),
), ),
Text( Text(
@ -448,8 +441,8 @@ class _SignInScreenState extends State<SignInScreen> {
TextButton( TextButton(
onPressed: onPressed:
_isBusy ? null : () => _requestResetPassword(), _isBusy ? null : () => _requestResetPassword(),
style: TextButton.styleFrom( style:
foregroundColor: Colors.grey), TextButton.styleFrom(foregroundColor: Colors.grey),
child: Text('forgotPassword'.tr), child: Text('forgotPassword'.tr),
), ),
TextButton( TextButton(
@ -475,10 +468,8 @@ class _SignInScreenState extends State<SignInScreen> {
Text( Text(
'termAcceptNextWithAgree'.tr, 'termAcceptNextWithAgree'.tr,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: Theme.of(context) style:
.textTheme Theme.of(context).textTheme.bodySmall!.copyWith(
.bodySmall!
.copyWith(
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.onSurface .onSurface
@ -509,7 +500,6 @@ class _SignInScreenState extends State<SignInScreen> {
), ),
}, },
), ),
),
).paddingAll(24), ).paddingAll(24),
); );
} }

View File

@ -3,7 +3,6 @@ import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:solian/exts.dart'; import 'package:solian/exts.dart';
import 'package:solian/services.dart'; import 'package:solian/services.dart';
import 'package:solian/widgets/root_container.dart';
import 'package:solian/widgets/sized_container.dart'; import 'package:solian/widgets/sized_container.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -66,8 +65,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootContainer( return CenteredContainer(
child: CenteredContainer(
maxWidth: 360, maxWidth: 360,
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
@ -96,8 +94,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
labelText: 'username'.tr, labelText: 'username'.tr,
), ),
onTapOutside: (_) => onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
FocusManager.instance.primaryFocus?.unfocus(),
), ),
const Gap(12), const Gap(12),
TextField( TextField(
@ -110,8 +107,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
labelText: 'nickname'.tr, labelText: 'nickname'.tr,
), ),
onTapOutside: (_) => onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
FocusManager.instance.primaryFocus?.unfocus(),
), ),
const Gap(12), const Gap(12),
TextField( TextField(
@ -124,8 +120,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
labelText: 'email'.tr, labelText: 'email'.tr,
), ),
onTapOutside: (_) => onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
FocusManager.instance.primaryFocus?.unfocus(),
), ),
const Gap(12), const Gap(12),
TextField( TextField(
@ -139,8 +134,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
labelText: 'password'.tr, labelText: 'password'.tr,
), ),
onTapOutside: (_) => onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
FocusManager.instance.primaryFocus?.unfocus(),
onSubmitted: (_) => _performAction(context), onSubmitted: (_) => _performAction(context),
), ),
const Gap(8), const Gap(8),
@ -206,7 +200,6 @@ class _SignUpScreenState extends State<SignUpScreen> {
), ),
) )
], ],
),
).paddingAll(24), ).paddingAll(24),
); );
} }

View File

@ -19,7 +19,6 @@ import 'package:solian/providers/database/database.dart';
import 'package:solian/providers/theme_switcher.dart'; import 'package:solian/providers/theme_switcher.dart';
import 'package:solian/router.dart'; import 'package:solian/router.dart';
import 'package:solian/widgets/reports/abuse_report.dart'; import 'package:solian/widgets/reports/abuse_report.dart';
import 'package:solian/widgets/root_container.dart';
class SettingScreen extends StatefulWidget { class SettingScreen extends StatefulWidget {
const SettingScreen({super.key}); const SettingScreen({super.key});
@ -83,8 +82,7 @@ class _SettingScreenState extends State<SettingScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootContainer( return ListView(
child: ListView(
children: [ children: [
_buildCaptionHeader('theme'.tr), _buildCaptionHeader('theme'.tr),
ListTile( ListTile(
@ -110,12 +108,16 @@ class _SettingScreenState extends State<SettingScreen> {
children: [ children: [
Icon(Icons.circle, color: item.seedColor), Icon(Icons.circle, color: item.seedColor),
const Gap(8), const Gap(8),
Text( Expanded(
child: Text(
item.id.tr, item.id.tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
),
], ],
), ),
)) ))
@ -196,8 +198,7 @@ class _SettingScreenState extends State<SettingScreen> {
) )
], ],
), ),
value: value: _prefs?.getBool('service_background_notification') ?? false,
_prefs?.getBool('service_background_notification') ?? false,
onChanged: (value) { onChanged: (value) {
_prefs _prefs
?.setBool('service_background_notification', value ?? false) ?.setBool('service_background_notification', value ?? false)
@ -215,9 +216,7 @@ class _SettingScreenState extends State<SettingScreen> {
subtitle: Text('updateCheckStrictlyDesc'.tr), subtitle: Text('updateCheckStrictlyDesc'.tr),
value: _prefs?.getBool('check_update_strictly') ?? false, value: _prefs?.getBool('check_update_strictly') ?? false,
onChanged: (value) { onChanged: (value) {
_prefs _prefs?.setBool('check_update_strictly', value ?? false).then((_) {
?.setBool('check_update_strictly', value ?? false)
.then((_) {
setState(() {}); setState(() {});
}); });
}, },
@ -335,7 +334,6 @@ class _SettingScreenState extends State<SettingScreen> {
}, },
), ),
], ],
),
); );
} }
} }

View File

@ -39,10 +39,13 @@ abstract class AppTheme {
brightness: brightness, brightness: brightness,
seedColor: seedColor ?? const Color.fromRGBO(154, 98, 91, 1), seedColor: seedColor ?? const Color.fromRGBO(154, 98, 91, 1),
), ),
scaffoldBackgroundColor: Colors.transparent,
snackBarTheme: const SnackBarThemeData( snackBarTheme: const SnackBarThemeData(
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
), ),
scaffoldBackgroundColor: Colors.transparent,
appBarTheme: const AppBarTheme(
backgroundColor: Colors.transparent,
),
fontFamily: 'Comfortaa', fontFamily: 'Comfortaa',
fontFamilyFallback: [ fontFamilyFallback: [
'NotoSansSC', 'NotoSansSC',
@ -74,6 +77,7 @@ abstract class AppTheme {
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
), ),
scaffoldBackgroundColor: Colors.transparent, scaffoldBackgroundColor: Colors.transparent,
appBarTheme: const AppBarTheme(backgroundColor: Colors.transparent),
fontFamily: data.fontFamily ?? 'Comfortaa', fontFamily: data.fontFamily ?? 'Comfortaa',
fontFamilyFallback: data.fontFamilyFallback ?? fontFamilyFallback: data.fontFamilyFallback ??
[ [

View File

@ -43,6 +43,10 @@ class MarkdownTextContent extends StatelessWidget {
if (isAutoWarp) { if (isAutoWarp) {
paragraph = paragraph.replaceAll('\n', '\\\n'); paragraph = paragraph.replaceAll('\n', '\\\n');
} }
const charactersToTrim = '\\\n\t\r ';
final trimPattern =
RegExp('^[$charactersToTrim]+|[$charactersToTrim]+\$');
paragraph = paragraph.trim().replaceAll(trimPattern, '');
// Matching stickers // Matching stickers
final stickerMatch = stickerRegex.allMatches(paragraph); final stickerMatch = stickerRegex.allMatches(paragraph);
@ -184,7 +188,7 @@ class MarkdownTextContent extends StatelessWidget {
); );
if (idx < paragraphs.length - 1) { if (idx < paragraphs.length - 1) {
contentWidgets.add(const Gap(4)); contentWidgets.add(isAutoWarp ? const Gap(4) : const Gap(8));
} }
} }