improve ui

This commit is contained in:
nyne
2024-10-27 16:39:38 +08:00
parent 910bda8cc1
commit 27d25db407
7 changed files with 58 additions and 7 deletions

View File

@@ -94,7 +94,11 @@ class FlyoutState extends State<Flyout> {
void show() { void show() {
var renderBox = context.findRenderObject() as RenderBox; var renderBox = context.findRenderObject() as RenderBox;
var rect = renderBox.localToGlobal(Offset.zero) & renderBox.size; var rect = renderBox.localToGlobal(Offset.zero) & renderBox.size;
var navigator = widget.navigator ?? Navigator.of(context); var navigator = widget.navigator ??
Navigator.of(
context,
rootNavigator: true,
);
navigator.push(PageRouteBuilder( navigator.push(PageRouteBuilder(
fullscreenDialog: true, fullscreenDialog: true,
barrierDismissible: true, barrierDismissible: true,
@@ -173,9 +177,9 @@ class FlyoutContent extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return IntrinsicWidth( return IntrinsicWidth(
child: BlurEffect( child: BlurEffect(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(8),
child: Material( child: Material(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(8),
type: MaterialType.card, type: MaterialType.card,
color: context.colorScheme.surface.withOpacity(0.82), color: context.colorScheme.surface.withOpacity(0.82),
child: Container( child: Container(
@@ -190,8 +194,7 @@ class FlyoutContent extends StatelessWidget {
Text(title, Text(title,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 16)), fontWeight: FontWeight.bold, fontSize: 16)),
if (content != null) if (content != null) content!,
content!,
const SizedBox( const SizedBox(
height: 12, height: 12,
), ),

View File

@@ -29,6 +29,16 @@ class CategoriesPage extends StatelessWidget {
.where((element) => allCategories.contains(element)) .where((element) => allCategories.contains(element))
.toList(); .toList();
if(categories.isEmpty) {
return NetworkError(
message: "No Category Pages".tl,
retry: () {
controller.update();
},
withAppbar: false,
);
}
return Material( return Material(
child: DefaultTabController( child: DefaultTabController(
length: categories.length, length: categories.length,

View File

@@ -272,7 +272,7 @@ class _CommentTileState extends State<_CommentTile> {
if (widget.comment.time != null) if (widget.comment.time != null)
Text(widget.comment.time!, style: ts.s12), Text(widget.comment.time!, style: ts.s12),
const SizedBox(height: 4), const SizedBox(height: 4),
Text(widget.comment.content), _CommentContent(text: widget.comment.content),
buildActions(), buildActions(),
], ],
), ),
@@ -490,3 +490,14 @@ class _CommentTileState extends State<_CommentTile> {
); );
} }
} }
class _CommentContent extends StatelessWidget {
const _CommentContent({required this.text});
final String text;
@override
Widget build(BuildContext context) {
return SelectableText(text);
}
}

View File

@@ -62,8 +62,22 @@ class _ExplorePageState extends State<ExplorePage>
Widget buildBody(String i) => _SingleExplorePage(i, key: Key(i)); Widget buildBody(String i) => _SingleExplorePage(i, key: Key(i));
Widget buildEmpty() {
return NetworkError(
message: "No Explore Pages".tl,
retry: () {
setState(() {});
},
withAppbar: false,
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (pages.isEmpty) {
return buildEmpty();
}
Widget tabBar = Material( Widget tabBar = Material(
child: FilledTabBar( child: FilledTabBar(
tabs: pages.map((e) => buildTab(e)).toList(), tabs: pages.map((e) => buildTab(e)).toList(),

View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sliver_tools/sliver_tools.dart';
import 'package:venera/components/components.dart'; import 'package:venera/components/components.dart';
import 'package:venera/foundation/app.dart'; import 'package:venera/foundation/app.dart';
import 'package:venera/foundation/appdata.dart'; import 'package:venera/foundation/appdata.dart';
@@ -168,7 +169,10 @@ class _SearchPageState extends State<SearchPage> {
yield buildSuggestions(context); yield buildSuggestions(context);
} else { } else {
yield buildSearchTarget(); yield buildSearchTarget();
yield buildSearchOptions(); yield SliverAnimatedPaintExtent(
duration: const Duration(milliseconds: 200),
child: buildSearchOptions(),
);
yield buildSearchHistory(); yield buildSearchHistory();
} }
} }

View File

@@ -518,6 +518,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
sliver_tools:
dependency: "direct main"
description:
name: sliver_tools
sha256: eae28220badfb9d0559207badcbbc9ad5331aac829a88cb0964d330d2a4636a6
url: "https://pub.dev"
source: hosted
version: "0.2.12"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:

View File

@@ -49,6 +49,7 @@ dependencies:
path: packages/desktop_webview_window path: packages/desktop_webview_window
flutter_inappwebview: ^6.1.5 flutter_inappwebview: ^6.1.5
app_links: ^6.3.2 app_links: ^6.3.2
sliver_tools: ^0.2.12
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: