mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 04:24:45 +08:00
re init
This commit is contained in:
25
lib/widgets/my_page_route.dart
Normal file
25
lib/widgets/my_page_route.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
|
||||
class MyPageRoute extends FluentPageRoute {
|
||||
late final WidgetBuilder _builder;
|
||||
|
||||
MyPageRoute({required super.builder}) : _builder = builder;
|
||||
|
||||
@override
|
||||
Widget buildPage(BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
assert(debugCheckHasFluentTheme(context));
|
||||
final result = _builder(context);
|
||||
return Semantics(
|
||||
scopesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
child: EntrancePageTransition(
|
||||
animation: CurvedAnimation(
|
||||
parent: animation,
|
||||
curve: FluentTheme.of(context).animationCurve,
|
||||
),
|
||||
child: result,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
110
lib/widgets/widgets.dart
Normal file
110
lib/widgets/widgets.dart
Normal file
@ -0,0 +1,110 @@
|
||||
import 'package:extended_image/extended_image.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:markdown_widget/config/all.dart';
|
||||
import 'package:markdown_widget/widget/all.dart';
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import '../base/ui.dart';
|
||||
|
||||
Widget makeLoading(
|
||||
BuildContext context, {
|
||||
double? width,
|
||||
}) {
|
||||
width ??= 30;
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
height: width,
|
||||
// child: Lottie.asset("images/lottie/loading.zip", width: width),
|
||||
child: const ProgressRing(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget makeSafeAre(BuildContext context, {bool withKeyboard = true}) {
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
if (withKeyboard)
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).viewInsets.bottom,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
makeSvgColor(Color color) {
|
||||
return ui.ColorFilter.mode(color, ui.BlendMode.srcIn);
|
||||
}
|
||||
|
||||
bool isPadUI(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
return size.width >= size.height;
|
||||
}
|
||||
|
||||
fastPadding(
|
||||
{required double? all,
|
||||
required Widget child,
|
||||
double left = 0.0,
|
||||
double top = 0.0,
|
||||
double right = 0.0,
|
||||
double bottom = 0.0}) {
|
||||
return Padding(
|
||||
padding: all != null
|
||||
? EdgeInsets.all(all)
|
||||
: EdgeInsets.only(left: left, top: top, right: right, bottom: bottom),
|
||||
child: child);
|
||||
}
|
||||
|
||||
List<Widget> makeMarkdownView(String description) {
|
||||
return MarkdownGenerator(
|
||||
config: MarkdownConfig(configs: [
|
||||
LinkConfig(onTap: (url) {
|
||||
if (url.startsWith("/")) {
|
||||
url = "${AppConf.gitlabHomeUrl}/$url";
|
||||
}
|
||||
launchUrlString(url);
|
||||
}),
|
||||
ImgConfig(builder: (String url, Map<String, String> attributes) {
|
||||
return ExtendedImage.network(
|
||||
url,
|
||||
loadStateChanged: (ExtendedImageState state) {
|
||||
switch (state.extendedImageLoadState) {
|
||||
case LoadState.loading:
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
ProgressRing(),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text("加载图片...")
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
case LoadState.completed:
|
||||
return ExtendedRawImage(
|
||||
image: state.extendedImageInfo?.image,
|
||||
);
|
||||
case LoadState.failed:
|
||||
return const Text("Loading Image error");
|
||||
}
|
||||
},
|
||||
);
|
||||
})
|
||||
])).buildWidgets(description);
|
||||
}
|
||||
|
||||
class NoScrollBehavior extends ScrollBehavior {
|
||||
@override
|
||||
Widget buildOverscrollIndicator(
|
||||
BuildContext context, Widget child, ScrollableDetails details) {
|
||||
return child;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user