Skip to content

Commit

Permalink
[fix]修复 管理员头像递归跳转 流畅加载 布局错误
Browse files Browse the repository at this point in the history
  • Loading branch information
steven12138 committed Mar 15, 2024
1 parent efc55d1 commit fa7cb78
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 83 deletions.
4 changes: 0 additions & 4 deletions lib/auth/view/info/unbind_dialogs.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:we_pei_yang_flutter/auth/network/auth_service.dart';
import 'package:we_pei_yang_flutter/commons/channel/statistics/umeng_statistics.dart';
import 'package:we_pei_yang_flutter/commons/network/classes_service.dart';
import 'package:we_pei_yang_flutter/commons/preferences/common_prefs.dart';
import 'package:we_pei_yang_flutter/commons/themes/template/wpy_theme_data.dart';
import 'package:we_pei_yang_flutter/commons/util/router_manager.dart';
import 'package:we_pei_yang_flutter/commons/util/text_util.dart';
import 'package:we_pei_yang_flutter/commons/util/toast_provider.dart';
import 'package:we_pei_yang_flutter/generated/l10n.dart';
import 'package:we_pei_yang_flutter/gpa/model/gpa_notifier.dart';
import 'package:we_pei_yang_flutter/main.dart';
import 'package:we_pei_yang_flutter/schedule/model/course_provider.dart';
import 'package:we_pei_yang_flutter/schedule/model/exam_provider.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/commons/themes/template/wpy_theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
import 'package:we_pei_yang_flutter/commons/themes/scheme/orange_scheme.dart';
import 'package:we_pei_yang_flutter/commons/themes/scheme/purple_scheme.dart';

import '../scheme/haitang_scheme.dart';
import '../scheme/dark_scheme.dart';
import '../scheme/green_scheme.dart';
import '../scheme/haitang_scheme.dart';
import '../scheme/light_scheme.dart';
import '../scheme/red_scheme.dart';
import '../scheme/yellow_scheme.dart';
Expand Down
24 changes: 24 additions & 0 deletions lib/commons/widgets/fluent_fade_switcher.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';

class FluentFadeSwitcher extends StatefulWidget {
Widget child;

FluentFadeSwitcher({super.key, required this.child});

@override
State<FluentFadeSwitcher> createState() => _FluentFadeSwitcherState();
}

class _FluentFadeSwitcherState extends State<FluentFadeSwitcher> {
@override
Widget build(BuildContext context) {
return Stack(
children: [
AnimatedSwitcher(
duration: Duration(milliseconds: 300),
child: widget.child,
),
],
);
}
}
33 changes: 20 additions & 13 deletions lib/feedback/view/components/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ import 'package:we_pei_yang_flutter/main.dart';

import '../../../commons/themes/template/wpy_theme_data.dart';
import '../../../commons/themes/wpy_theme.dart';
import '../../../commons/widgets/w_button.dart';

class PostCardNormal extends StatefulWidget {
/// 标准 PostCard
///
/// 包括论坛首页展示的 (outer = true / null) 和 详情页展示的 (outer = false)
PostCardNormal(this.post,
{this.outer = true, this.screenshotController, this.expandAll = false});
{this.outer = true,
this.screenshotController,
this.expandAll = false,
this.avatarClickable = true});

final bool expandAll;
final Post post;
final bool avatarClickable;

final ScreenshotController? screenshotController;

Expand Down Expand Up @@ -73,16 +76,19 @@ class _PostCardNormalState extends State<PostCardNormal> {
: SplitUtil.h * 56,
child: Row(children: [
SizedBox(width: SplitUtil.w * 2),
ProfileImageWithDetailedPopup(
post.id,
true,
post.type,
post.avatar,
post.uid,
post.nickname,
post.level.toString(),
post.id.toString(),
post.avatarBox.toString()),
IgnorePointer(
ignoring: !widget.avatarClickable,
child: ProfileImageWithDetailedPopup(
post.id,
true,
post.type,
post.avatar,
post.uid,
post.nickname,
post.level.toString(),
post.id.toString(),
post.avatarBox.toString()),
),
Expanded(
child: Container(
color: Colors.transparent, // 没他就没有点击域
Expand Down Expand Up @@ -372,7 +378,8 @@ class _PostCardNormalState extends State<PostCardNormal> {
bottom: SplitUtil.h * 8),
child: outerImages),
Padding(
padding: EdgeInsets.only(left: SplitUtil.w * 10),
padding:
EdgeInsets.symmetric(horizontal: SplitUtil.w * 10),
child: likeUnlikeVisit,
)
],
Expand Down
1 change: 0 additions & 1 deletion lib/feedback/view/components/widget/activity_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:we_pei_yang_flutter/commons/util/toast_provider.dart';
import 'package:we_pei_yang_flutter/feedback/view/components/widget/round_taggings.dart';
import 'package:we_pei_yang_flutter/feedback/view/lake_home_page/lake_notifier.dart';
import 'package:we_pei_yang_flutter/home/view/web_views/festival_page.dart';
import 'package:we_pei_yang_flutter/main.dart';

class ActivityCard extends StatefulWidget {
final double width;
Expand Down
3 changes: 1 addition & 2 deletions lib/feedback/view/components/widget/linkify_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class LinkText extends StatefulWidget {

class _LinkTextState extends State<LinkText> {
bool checkBili(String url) {
return url.startsWith('https://b23.tv/') ||
url.startsWith('https://www.bilibili.com/');
return url.contains('b23.tv') || url.contains('bilibili.com');
}

@override
Expand Down
11 changes: 9 additions & 2 deletions lib/feedback/view/components/widget/long_text_shower.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,19 @@ class _ExpandableTextState extends State<ExpandableText> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(expand ? '收起' : '全文',
style: TextUtil.base.textButtonPrimary(context).w400.NotoSansSC
style: TextUtil.base
.textButtonPrimary(context)
.w400
.NotoSansSC
.sp(16)),
SizedBox(width: 6),
if (!expand)
Text('共${text.length}字',
style: TextUtil.base.infoText(context).w400.NotoSansSC.sp(15))
style: TextUtil.base
.infoText(context)
.w400
.NotoSansSC
.sp(15))
],
),
),
Expand Down
1 change: 0 additions & 1 deletion lib/feedback/view/lake_home_page/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:extended_tabs/extended_tabs.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:we_pei_yang_flutter/commons/preferences/common_prefs.dart';
import 'package:we_pei_yang_flutter/commons/util/text_util.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/feedback/view/lake_home_page/normal_sub_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';

import 'package:dio/dio.dart';
Expand Down
114 changes: 66 additions & 48 deletions lib/feedback/view/person_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class _PersonPageState extends State<PersonPage> {
(index) {
Widget post = PostCardNormal(
_postList[index],
avatarClickable: false,
);
return post;
},
Expand Down Expand Up @@ -303,29 +304,45 @@ class _PersonPageState extends State<PersonPage> {
],
);

return Container(
color: WpyTheme.of(context).get(WpyColorKey.primaryBackgroundColor),
child: SafeArea(
child: (CommonPreferences.isSuper.value ||
CommonPreferences.isStuAdmin.value)
? SmartRefresher(
physics: BouncingScrollPhysics(),
controller: _refreshController,
header: RefreshHeader(context),
footer: ClassicFooter(
idleText: '没有更多数据了:>',
idleIcon: Icon(Icons.check),
),
enablePullDown: true,
onRefresh: _onRefresh,
enablePullUp: true,
onLoading: _onLoading,
child: body,
)
: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
return Scaffold(
appBar: AppBar(
title: Text('个人主页'),
centerTitle: true,
titleTextStyle: TextUtil.base.w600.NotoSansSC.sp(16).primary(context),
backgroundColor:
WpyTheme.of(context).get(WpyColorKey.primaryBackgroundColor),
shadowColor: Colors.transparent,
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: WpyTheme.of(context).get(WpyColorKey.oldActionColor),
),
onPressed: () => Navigator.pop(context),
),
),
body: Container(
color: WpyTheme.of(context).get(WpyColorKey.primaryBackgroundColor),
child: SafeArea(
child: (CommonPreferences.isSuper.value ||
CommonPreferences.isStuAdmin.value)
? SmartRefresher(
physics: BouncingScrollPhysics(),
controller: _refreshController,
header: RefreshHeader(context),
footer: ClassicFooter(
idleText: '没有更多数据了:>',
idleIcon: Icon(Icons.check),
),
enablePullDown: true,
onRefresh: _onRefresh,
enablePullUp: true,
onLoading: _onLoading,
child: body,
)
: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: WpyPic(
avatar == ""
? '${EnvConfig.QNHD}avatar/beam/20/${uid}.svg'
Expand All @@ -336,35 +353,36 @@ class _PersonPageState extends State<PersonPage> {
alignment: Alignment.topCenter,
),
),
Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () => Navigator.pop(context),
child: Container(
height: 1.sw,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
WpyTheme.of(context)
.get(WpyColorKey.primaryBackgroundColor),
WpyTheme.of(context)
.get(WpyColorKey.backgroundMaskColor),
WpyTheme.of(context)
.get(WpyColorKey.backgroundGradientEndColor),
WpyTheme.of(context)
.get(WpyColorKey.liteBackgroundMaskColor)
],
stops: [0, 0.4, 0.7, 1],
begin: Alignment(0, -1),
end: Alignment(0, 1),
Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () => Navigator.pop(context),
child: Container(
height: 1.sw,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
WpyTheme.of(context)
.get(WpyColorKey.primaryBackgroundColor),
WpyTheme.of(context)
.get(WpyColorKey.backgroundMaskColor),
WpyTheme.of(context).get(
WpyColorKey.backgroundGradientEndColor),
WpyTheme.of(context)
.get(WpyColorKey.liteBackgroundMaskColor)
],
stops: [0, 0.4, 0.7, 1],
begin: Alignment(0, -1),
end: Alignment(0, 1),
),
),
),
),
),
),
SingleChildScrollView(child: appBar),
],
),
SingleChildScrollView(child: appBar),
],
),
),
),
);
}
Expand Down
16 changes: 15 additions & 1 deletion lib/feedback/view/post_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ class _PostDetailPageState extends State<PostDetailPage>
],
);
body = Stack(
key: ValueKey("loaded"),
children: [
Column(
children: [
Expand Down Expand Up @@ -1020,7 +1021,20 @@ class _PostDetailPageState extends State<PostDetailPage>
backgroundColor:
WpyTheme.of(context).get(WpyColorKey.primaryBackgroundColor),
appBar: appBar,
body: body,
body: AnimatedSwitcher(
duration: Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) {
if (child.key != ValueKey("loaded")) {
return child;
} else {
return FadeTransition(
opacity: animation,
child: child,
);
}
},
child: body,
),
),
),
onHorizontalDragUpdate: (DragUpdateDetails details) {
Expand Down
6 changes: 5 additions & 1 deletion lib/feedback/view/reply_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class _ReplyDetailPageState extends State<ReplyDetailPage>
),
);
Widget mainList1 = ListView.builder(
key: ValueKey(floors != null ? floors!.length : 0),
itemCount: floors != null ? floors!.length + 1 : 0 + 1,
itemBuilder: (context, index) {
if (index == 0) {
Expand Down Expand Up @@ -209,7 +210,10 @@ class _ReplyDetailPageState extends State<ReplyDetailPage>
onRefresh: _onRefresh,
enablePullUp: true,
onLoading: _onLoading,
child: mainList1,
child: AnimatedSwitcher(
duration: Duration(milliseconds: 300),
child: mainList1,
),
),
onNotification: (ScrollNotification scrollInfo) =>
_onScrollNotification(scrollInfo),
Expand Down
1 change: 1 addition & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';

import 'package:amap_location_fluttify/amap_location_fluttify.dart';
import 'package:flutter/foundation.dart'
Expand All @@ -12,11 +11,10 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:provider/provider.dart';
import 'package:we_pei_yang_flutter/commons/themes/template/wpy_theme_data.dart';
import 'package:we_pei_yang_flutter/commons/font/font_loader.dart';
import 'package:we_pei_yang_flutter/commons/widgets/colored_icon.dart';
import 'package:we_pei_yang_flutter/studyroom/model/studyroom_provider.dart';
import 'package:window_manager/window_manager.dart';
import 'package:we_pei_yang_flutter/commons/widgets/colored_icon.dart';

import 'auth/network/auth_service.dart';
import 'auth/network/message_service.dart';
Expand Down Expand Up @@ -48,7 +46,6 @@ import 'message/model/message_provider.dart';
import 'schedule/model/course_provider.dart';
import 'schedule/model/exam_provider.dart';
import 'schedule/schedule_providers.dart';
import 'studyroom/model/studyroom_provider.dart';
import 'urgent_report/report_server.dart';

/// 应用入口
Expand Down
Loading

0 comments on commit fa7cb78

Please sign in to comment.