🐛 Bug fixes on somewhere

This commit is contained in:
LittleSheep 2024-12-14 01:36:23 +08:00
parent f763c7515a
commit b618fcc6da
5 changed files with 29 additions and 12 deletions

View File

@ -32,6 +32,7 @@ import 'package:surface/types/chat.dart';
import 'package:surface/types/realm.dart'; import 'package:surface/types/realm.dart';
import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy; import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy;
import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/dialog.dart';
import 'package:surface/widgets/version_label.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -196,6 +197,7 @@ class _AppSplashScreenState extends State<_AppSplashScreen> {
), ),
const Gap(20), const Gap(20),
Text('appInitializing'.tr(), textAlign: TextAlign.center), Text('appInitializing'.tr(), textAlign: TextAlign.center),
AppVersionLabel(),
], ],
), ),
).center(), ).center(),

View File

@ -1,6 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
@ -111,7 +109,7 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
try { try {
final sn = context.read<SnNetworkProvider>(); final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.post( await sn.client.post(
'/cgi/im/channels/${_messageController.channel!.keyPath}/calls', '/cgi/im/channels/${_messageController.channel!.keyPath}/calls',
options: Options( options: Options(
sendTimeout: const Duration(seconds: 30), sendTimeout: const Duration(seconds: 30),

View File

@ -6,6 +6,7 @@ import 'package:provider/provider.dart';
import 'package:responsive_framework/responsive_framework.dart'; import 'package:responsive_framework/responsive_framework.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'package:surface/providers/navigation.dart'; import 'package:surface/providers/navigation.dart';
import 'package:surface/widgets/version_label.dart';
class AppNavigationDrawer extends StatefulWidget { class AppNavigationDrawer extends StatefulWidget {
final double? elevation; final double? elevation;
@ -49,14 +50,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('Solar Network').bold(), Text('Solar Network').bold(),
FutureBuilder<String>( AppVersionLabel(),
future: PackageInfo.fromPlatform().then((value) => 'Stable ${value.version}+${value.buildNumber}'),
builder: (context, snapshot) {
return Text(!snapshot.hasData ? 'Stable 2.0' : snapshot.data!)
.fontSize(12)
.textColor(Theme.of(context).colorScheme.onSurface.withOpacity(0.5));
},
),
], ],
).padding( ).padding(
horizontal: 32, horizontal: 32,

View File

@ -203,6 +203,7 @@ class PostItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_PostContentHeader( _PostContentHeader(
isAuthor: isAuthor,
data: data, data: data,
showMenu: showMenu, showMenu: showMenu,
onShare: () => _doShare(context), onShare: () => _doShare(context),
@ -299,6 +300,7 @@ class PostShareImageWidget extends StatelessWidget {
), ),
).padding(bottom: 8), ).padding(bottom: 8),
_PostContentHeader( _PostContentHeader(
isAuthor: false,
data: data, data: data,
onDeleted: () {}, onDeleted: () {},
onShare: () {}, onShare: () {},
@ -629,7 +631,7 @@ class _PostContentHeader extends StatelessWidget {
const _PostContentHeader({ const _PostContentHeader({
required this.data, required this.data,
this.isAuthor = false, required this.isAuthor,
this.isCompact = false, this.isCompact = false,
this.isRelativeDate = true, this.isRelativeDate = true,
this.showMenu = true, this.showMenu = true,
@ -894,6 +896,7 @@ class _PostQuoteContent extends StatelessWidget {
Column( Column(
children: [ children: [
_PostContentHeader( _PostContentHeader(
isAuthor: false,
data: child, data: child,
isCompact: true, isCompact: true,
isRelativeDate: isRelativeDate, isRelativeDate: isRelativeDate,

View File

@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:styled_widget/styled_widget.dart';
class AppVersionLabel extends StatelessWidget {
final double fontSize;
const AppVersionLabel({super.key, this.fontSize = 12});
@override
Widget build(BuildContext context) {
return FutureBuilder<String>(
future: PackageInfo.fromPlatform().then((value) => 'Stable ${value.version}+${value.buildNumber}'),
builder: (context, snapshot) {
return Text(!snapshot.hasData ? 'Stable 2.0' : snapshot.data!).fontSize(fontSize).textColor(
Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
);
},
);
}
}