Skip to content

Commit

Permalink
v0.2.13+23
Browse files Browse the repository at this point in the history
  • Loading branch information
cabbagelol committed Dec 13, 2024
1 parent 930fe92 commit ff2c14a
Show file tree
Hide file tree
Showing 22 changed files with 479 additions and 303 deletions.
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.7.2' apply false
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
}

include ":app"
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "BFBAN Assistants";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -528,7 +528,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "BFBAN Assistants";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -564,7 +564,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "BFBAN Assistants";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
16 changes: 11 additions & 5 deletions lib/component/_html/htmlImage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import '../../utils/index.dart';
import '../../widgets/index.dart';

class HtmlImage extends StatefulWidget {
final String? src;
final String src;
final Color? color;
final Color? backgroundColor;

const HtmlImage({
super.key,
this.src,
required this.src,
this.color,
this.backgroundColor,
});
Expand All @@ -37,7 +37,7 @@ class _HtmlImageState extends State<HtmlImage> {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) {
return Hero(
tag: "image",
tag: "image.timeline.$imageUrl",
child: PhotoViewSimpleScreen(
type: PhotoViewFileType.network,
imageUrl: imageUrl,
Expand Down Expand Up @@ -179,11 +179,17 @@ class _HtmlImageState extends State<HtmlImage> {
child: AnimatedRotation(
turns: turns,
duration: const Duration(milliseconds: 0),
child: Hero(tag: "image", child: Image(image: state.imageProvider, fit: BoxFit.fitWidth)),
child: Hero(
tag: "image.timeline.${widget.src}",
child: Image(
image: state.imageProvider,
fit: BoxFit.fitWidth,
),
),
),
),
onTap: () {
onImageTap(context, widget.src.toString());
onImageTap(context, widget.src);
},
),
),
Expand Down
58 changes: 36 additions & 22 deletions lib/component/_html/htmlLink.dart
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../utils/index.dart';

class HtmlLink extends StatelessWidget {
final UrlUtil _urlUtil = UrlUtil();

String? url;
class HtmlLink extends StatefulWidget {
final String? url;

Color? color;
final Color? color;

String? text;
final String? text;

final TextStyle? style;

bool softWrap;
final bool softWrap;

int? maxLines;
final int? maxLines;

TextOverflow? overflow;
final TextOverflow? overflow;

HtmlLink({
const HtmlLink({
super.key,
required this.url,
this.color = Colors.blue,
this.color,
this.text,
this.style,
this.softWrap = true,
this.maxLines,
this.overflow,
});

@override
State<HtmlLink> createState() => _HtmlLinkState();
}

class _HtmlLinkState extends State<HtmlLink> {
final UrlUtil _urlUtil = UrlUtil();

Color color = Colors.blue;

/// [Event]
Widget linkIcon(TextStyle? style) {
color = Color.lerp(Colors.blue, Theme.of(context).colorScheme.primary, .8)!;

style ??= TextStyle(color: color, fontSize: 15.0);

String scheme = url!.split(":")[0];
String scheme = widget.url!.split(":")[0];
double? iconSize = style.fontSize ?? 15.0;
Color? iconColor = style.color ?? color;

Expand All @@ -56,38 +66,42 @@ class HtmlLink extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
child: Tooltip(
message: url,
message: widget.url,
child: Text.rich(
TextSpan(
style: TextStyle(
color: color,
decorationColor: color!.withOpacity(.7),
decorationColor: color.withOpacity(.7),
),
children: [
WidgetSpan(
child: Container(
padding: const EdgeInsets.only(right: 5),
child: linkIcon(style),
child: linkIcon(widget.style),
),
),
TextSpan(
text: (text ?? url).toString().trim(),
style: (style ?? const TextStyle()).copyWith(
text: (widget.text ?? widget.url).toString().trim(),
style: (widget.style ?? const TextStyle()).copyWith(
overflow: TextOverflow.fade,
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.dotted,
),
),
],
),
softWrap: softWrap,
maxLines: maxLines,
overflow: overflow,
textWidthBasis: (!softWrap) ? TextWidthBasis.longestLine : TextWidthBasis.parent,
softWrap: widget.softWrap,
maxLines: widget.maxLines,
overflow: widget.overflow,
textWidthBasis: (!widget.softWrap) ? TextWidthBasis.longestLine : TextWidthBasis.parent,
),
),
onLongPress: () {
Clipboard.setData(ClipboardData(text: widget.url!));
},
onTap: () {
_urlUtil.onPeUrl(
url!,
widget.url!,
mode: LaunchMode.externalApplication,
);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/component/_html/htmlWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class CardUtil {
bottom: extensionContext.style!.margin!.bottom!.value,
),
child: HtmlImage(
src: extensionContext.node.attributes["src"],
src: extensionContext.node.attributes["src"] as String,
color: extensionContext.style!.color,
backgroundColor: extensionContext.style!.backgroundColor,
),
Expand Down
7 changes: 5 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ void runMain() async {
// 路由初始
Routes.configureRoutes(FluroRouter());

// 设置系统状态栏
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
// 设置系统
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);

runApp(const BfBanApp());

Expand Down
67 changes: 38 additions & 29 deletions lib/pages/index/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
waitMap["load"] = _homeTrendPageKey.currentState?.trendStatus.load ?? false;
break;
default:
// Null
// Null
break;
}
_homeTabs.add(waitMap);
Expand Down Expand Up @@ -131,35 +131,44 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10, tileMode: TileMode.decal),
child: const SizedBox(),
),
title: TabBar(
controller: tabController,
isScrollable: false,
tabs: homeTabs.map((e) {
return Tab(
iconMargin: EdgeInsets.zero,
child: e["load"] ?? false
? const Text("-")
: Container(
padding: EdgeInsets.zero,
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width / 4,
),
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
// e["icon"],
// const SizedBox(width: 5),
Text(
"${e["text"]}",
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 1,
title: PreferredSize(
preferredSize: Size(0, 55),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TabBar(
controller: tabController,
isScrollable: false,
tabs: homeTabs.map((e) {
return Tab(
iconMargin: EdgeInsets.zero,
child: e["load"] ?? false
? const Text("-")
: Container(
padding: EdgeInsets.zero,
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width / 4,
),
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
// e["icon"],
// const SizedBox(width: 5),
Text(
"${e["text"]}",
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
],
),
),
);
}).toList(),
);
}).toList(),
),
Divider(height: 1),
],
),
),
),
),
Expand Down
Loading

0 comments on commit ff2c14a

Please sign in to comment.