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

View File

@ -1,6 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart';
@ -111,7 +109,7 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
try {
final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.post(
await sn.client.post(
'/cgi/im/channels/${_messageController.channel!.keyPath}/calls',
options: Options(
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:styled_widget/styled_widget.dart';
import 'package:surface/providers/navigation.dart';
import 'package:surface/widgets/version_label.dart';
class AppNavigationDrawer extends StatefulWidget {
final double? elevation;
@ -49,14 +50,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Solar Network').bold(),
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(12)
.textColor(Theme.of(context).colorScheme.onSurface.withOpacity(0.5));
},
),
AppVersionLabel(),
],
).padding(
horizontal: 32,

View File

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