Skip to content

Commit

Permalink
0.2.17
Browse files Browse the repository at this point in the history
### Fixed
- Fixed save url error when user login
- Optimize image loading performance.
  • Loading branch information
ChenDoXiu committed Apr 16, 2024
1 parent 84cfa8c commit d921998
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 67 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog
## 0.2.15

## 0.2.17
### Fixed
- Fixed save url error when user login
- Optimize image loading performance.

## 0.2.16
### Fixed
- add macOS network permission #10

Expand Down
4 changes: 4 additions & 0 deletions lib/widgets/login/servers_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class ServersSelectCard extends HookConsumerWidget {
if (value.isEmpty) return;
// 纯域名
if (RegExp("^https?://.+").hasMatch(value)) {
// 如果最后是以 / 结尾 尝试删除
if (value.endsWith('/')) {
value = value.substring(0, value.length - 1);
}
login(context, ref, value);
return;
}
Expand Down
38 changes: 20 additions & 18 deletions lib/widgets/mfm_text/mfm_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,27 @@ class MFMText extends HookConsumerWidget {
currentServerHost: currentServerHost,
systemEmojis: emoji.valueOrNull ?? {},
);
Widget rich = Text.rich(
TextSpan(
children: [
...?before,
for (var item in mfmParse.value)
if (parse[item.type] != null)
parse[item.type](
item,
textStyle,
)
else
TextSpan(text: item.toString()),
...?after
],
style: Theme.of(context).textTheme.bodyMedium,
Widget rich = RepaintBoundary(
child: Text.rich(
TextSpan(
children: [
...?before,
for (var item in mfmParse.value)
if (parse[item.type] != null)
parse[item.type](
item,
textStyle,
)
else
TextSpan(text: item.toString()),
...?after
],
style: Theme.of(context).textTheme.bodyMedium,
),
maxLines: maxLines,
overflow: overflow,
textAlign: textAlign,
),
maxLines: maxLines,
overflow: overflow,
textAlign: textAlign,
);
lastText.value = text;
if (isSelection) {
Expand Down
70 changes: 36 additions & 34 deletions lib/widgets/mk_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,43 @@ class MkImage extends StatelessWidget {
child: SvgPicture.network(url, width: width, height: height, fit: fit),
);
}
return ExtendedImage(
image: getExtendedResizeImage(url),
shape: shape,
loadStateChanged: (state) {
switch (state.extendedImageLoadState) {
case LoadState.completed:
return ExtendedRawImage(
image: state.extendedImageInfo?.image,
height: height,
width: width,
fit: fit,
filterQuality: FilterQuality.medium,
);
case LoadState.loading:
if (blurHash != null) {
return LayoutBuilder(
builder: (context, constraints) {
// 当某些情况拿不到最大高度的时候,用最小高度代替
var height = constraints.maxHeight;
if (constraints.maxHeight == double.infinity) {
height = constraints.minHeight;
}
return SizedBox(
height: height,
width: width,
child: BlurHash(hash: blurHash!),
);
},
return RepaintBoundary(
child: ExtendedImage(
image: getExtendedResizeImage(url),
shape: shape,
loadStateChanged: (state) {
switch (state.extendedImageLoadState) {
case LoadState.completed:
return ExtendedRawImage(
image: state.extendedImageInfo?.image,
height: height,
width: width,
fit: fit,
filterQuality: FilterQuality.medium,
);
}
return const SizedBox(width: 0, height: 0);
case LoadState.failed:
return const SizedBox(width: 0, height: 0);
}
},
case LoadState.loading:
if (blurHash != null) {
return LayoutBuilder(
builder: (context, constraints) {
// 当某些情况拿不到最大高度的时候,用最小高度代替
var height = constraints.maxHeight;
if (constraints.maxHeight == double.infinity) {
height = constraints.minHeight;
}
return SizedBox(
height: height,
width: width,
child: BlurHash(hash: blurHash!),
);
},
);
}
return const SizedBox(width: 0, height: 0);
case LoadState.failed:
return const SizedBox(width: 0, height: 0);
}
},
),
);
}
}
12 changes: 7 additions & 5 deletions lib/widgets/mk_parallax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ class Parallax extends StatelessWidget {
final double offset;
@override
Widget build(BuildContext context) {
return ClipRect(
// clipBehavior: Clip.none,
child: CustomSingleChildLayout(
delegate: _ParallaxDelegate(offset: offset),
child: child,
return RepaintBoundary(
child: ClipRect(
// clipBehavior: Clip.none,
child: CustomSingleChildLayout(
delegate: _ParallaxDelegate(offset: offset),
child: child,
),
),
);
}
Expand Down
20 changes: 12 additions & 8 deletions lib/widgets/notes/note_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class TimeLineNoteCardComponent extends HookConsumerWidget {
),
if (data.user.instance != null) const SizedBox(height: 4),
if (data.user.instance != null)
UserInstanceBar(data: data),
RepaintBoundary(child: UserInstanceBar(data: data)),
// start
MkOverflowShow(
content: Column(
Expand Down Expand Up @@ -358,9 +358,10 @@ class TimeLineNoteCardComponent extends HookConsumerWidget {
mainAxisExtent: constraints.maxWidth * 0.7),
// 链接预览
if (isShowUrlPreview)
for (var link in links)
for (var link in links) ...[
NoteLinkPreview(
link: link, fontsize: fontsize),
link: link, fontsize: fontsize)
],
if (innerWidget != null) innerWidget!,
],
],
Expand Down Expand Up @@ -442,6 +443,7 @@ class NoteLinkPreview extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
var themes = ref.watch(themeColorsProvider);
var res = ref.watch(getUriInfoProvider(link));
print(res);
if (res.valueOrNull != null) {
var data = res.valueOrNull;
return Container(
Expand Down Expand Up @@ -617,11 +619,13 @@ class ReNoteUserInfo extends HookConsumerWidget {
),
),
),
Text(timeAgoSinceDate(data.createdAt),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: fontsize,
color: themes.reNoteColor))
RepaintBoundary(
child: Text(timeAgoSinceDate(data.createdAt),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: fontsize,
color: themes.reNoteColor)),
)
],
);
});
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.2.16+18
version: 0.2.17+19

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down

0 comments on commit d921998

Please sign in to comment.