Skip to content

Commit

Permalink
Clean up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
3003h committed Oct 29, 2024
1 parent c1e2d3a commit e6b3202
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 73 deletions.
22 changes: 10 additions & 12 deletions lib/pages/filter/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,16 @@ class _GalleryCatButtonState extends State<GalleryCatButton> {
@override
Widget build(BuildContext context) {
// loggerNoStack.v('GalleryCatButton build [${widget.text}] [$_value]');
return Container(
child: GestureDetector(
onLongPress: _onLongPress,
child: CupertinoButton(
padding: const EdgeInsets.all(2.0),
onPressed: _onPressed,
pressedOpacity: 1.0,
child: Text(
widget.text,
style: TextStyle(color: _textColor),
),
color: _color,
return GestureDetector(
onLongPress: _onLongPress,
child: CupertinoButton(
padding: const EdgeInsets.all(2.0),
onPressed: _onPressed,
pressedOpacity: 1.0,
color: _color,
child: Text(
widget.text,
style: TextStyle(color: _textColor),
),
),
);
Expand Down
58 changes: 28 additions & 30 deletions lib/pages/gallery/view/gallery_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,20 @@ class ReadButton extends StatelessWidget {
return Obx(
() => MouseRegionClick(
child: CupertinoButton(
child: Text(
(_pageState.lastIndex > 0)
? '${L10n.of(context).read.toUpperCase()} ${_pageState.lastIndex + 1}'
: L10n.of(context).read.toUpperCase(),
style: const TextStyle(fontSize: 15, height: 1.2),
),
minSize: 24,
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 6),
borderRadius: BorderRadius.circular(20),
color: CupertinoColors.activeBlue,
onPressed: _pageState.enableRead
? () => _toViewPage(_pageState.galleryProvider?.gid ?? '0',
_pageState.lastIndex)
: null),
: null,
child: Text(
(_pageState.lastIndex > 0)
? '${L10n.of(context).read.toUpperCase()} ${_pageState.lastIndex + 1}'
: L10n.of(context).read.toUpperCase(),
style: const TextStyle(fontSize: 15, height: 1.2),
)),
),
);
}
Expand Down Expand Up @@ -706,33 +706,31 @@ class TextBtn extends StatelessWidget {
CupertinoThemeData(primaryColor: color ?? CupertinoColors.systemGrey),
child: GestureDetector(
// behavior: HitTestBehavior.opaque,
child: Container(
// padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Container(
padding: iconPadding,
child: MouseRegionClick(
disable: onTap == null && onLongPress == null,
child: CupertinoButton(
padding: const EdgeInsets.only(bottom: 8.0),
child: Icon(
iconData,
size: iconSize ?? 28,
// color: CupertinoColors.systemGrey3,
),
onPressed: onTap,
onLongPress: onLongPress,
// behavior: HitTestBehavior.opaque,
child: Column(
children: <Widget>[
Container(
padding: iconPadding,
child: MouseRegionClick(
disable: onTap == null && onLongPress == null,
child: CupertinoButton(
padding: const EdgeInsets.only(bottom: 8.0),
onPressed: onTap,
child: Icon(
iconData,
size: iconSize ?? 28,
// color: CupertinoColors.systemGrey3,
),
),
),
Text(
title ?? '',
style: const TextStyle(fontSize: 12, height: 1),
),
],
),
),
Text(
title ?? '',
style: const TextStyle(fontSize: 12, height: 1),
),
],
),
onLongPress: onLongPress,
),
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/login/view/login_cookie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,21 @@ class LoginCookie extends GetView<LoginController> {
child: GetBuilder<LoginController>(
builder: (logic) {
return CupertinoButton(
child: logic.loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
color: CupertinoColors.activeBlue,
onPressed: logic.loadingLogin
? null
: logic.pressLoginCookie,
child: logic.loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
);
},
),
),
CupertinoButton(
minSize: 50,
padding: const EdgeInsets.all(20),
onPressed: controller.readCookieFromClipboard,
child: Column(
children: [
const Icon(
Expand All @@ -98,7 +99,6 @@ class LoginCookie extends GetView<LoginController> {
textScaleFactor: 0.8),
],
),
onPressed: controller.readCookieFromClipboard,
),
],
),
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/setting/block/block_rule_edit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class BlockRuleEditPage extends GetView<BlockController> {
trailing: CupertinoButton(
padding: const EdgeInsets.all(0),
minSize: 40,
child: const Icon(
CupertinoIcons.check_mark_circled,
size: 28,
),
onPressed: controller.isRegexFormatError
? null
: () async {
Expand All @@ -48,6 +44,10 @@ class BlockRuleEditPage extends GetView<BlockController> {
result: _blockRule,
);
},
child: const Icon(
CupertinoIcons.check_mark_circled,
size: 28,
),
),
),
child: CustomScrollView(slivers: [
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/setting/image_block/phash_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ class ImageHideItem extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(right: 12),
child: ClipRRect(
child: Container(
borderRadius: BorderRadius.circular(8.0),
child: SizedBox(
width: 50,
child: EhNetworkImage(imageUrl: imageHide.imageUrl ?? ''),
),
borderRadius: BorderRadius.circular(8.0),
),
),
Text(
Expand All @@ -82,13 +82,14 @@ class ImageHideItem extends StatelessWidget {
),
),
CupertinoButton(
// 清除按钮
onPressed: onDelete,
// 清除按钮
child: const Icon(
CupertinoIcons.xmark_circle,
color: CupertinoColors.systemRed,
size: 26,
),
onPressed: onDelete,
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/setting/log_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class LogPage extends GetView<LogService> {
// 清除按钮
padding: const EdgeInsets.all(0),
minSize: 40,
onPressed: controller.removeAll,
child: const Icon(
CupertinoIcons.trash,
size: 24,
),
onPressed: controller.removeAll,
),
),
child: CustomScrollView(slivers: [
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/setting/mysql/mysql_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ class _MysqlLoginState extends State<MysqlLogin> {
const BorderRadius.all(Radius.circular(30.0)),
padding: const EdgeInsets.symmetric(
horizontal: 30, vertical: 10),
child: _loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
color: CupertinoColors.activeBlue,
onPressed: _loadingLogin
? null
Expand Down Expand Up @@ -191,6 +188,9 @@ class _MysqlLoginState extends State<MysqlLogin> {
});
}
},
child: _loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/setting/tag_translat_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class ListViewTagTranslate extends StatelessWidget {
children: [
CupertinoButton(
padding: const EdgeInsets.all(0),
child: const Icon(CupertinoIcons.refresh),
onPressed: _forceUpdateTranslate,
child: const Icon(CupertinoIcons.refresh),
),
CupertinoSwitch(
value: _ehSettingService.isTagTranslate,
Expand Down
12 changes: 6 additions & 6 deletions lib/pages/setting/webdav/login_webdav.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ class LoginWebDAV extends GetView<WebdavController> {
const BorderRadius.all(Radius.circular(30.0)),
padding: const EdgeInsets.symmetric(
horizontal: 30, vertical: 10),
child: controller.testingConnect
? const CupertinoActivityIndicator()
: Text('Test'),
color: CupertinoColors.activeOrange,
onPressed: () async {
// final rult = await controller.pressLoginWebDAV();
await controller.testWebDav();
},
child: controller.testingConnect
? const CupertinoActivityIndicator()
: Text('Test'),
);
}),
CupertinoButton(
Expand All @@ -130,9 +130,6 @@ class LoginWebDAV extends GetView<WebdavController> {
const BorderRadius.all(Radius.circular(30.0)),
padding: const EdgeInsets.symmetric(
horizontal: 30, vertical: 10),
child: controller.loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
color: CupertinoColors.activeBlue,
onPressed: controller.loadingLogin
? null
Expand All @@ -143,6 +140,9 @@ class LoginWebDAV extends GetView<WebdavController> {
Get.back(id: isLayoutLarge ? 2 : null);
}
},
child: controller.loadingLogin
? const CupertinoActivityIndicator()
: Text(L10n.of(context).login),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/tab/view/download_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ class _DownloadTabState extends State<DownloadTab> {
CupertinoButton(
minSize: 40,
padding: const EdgeInsets.all(0),
onPressed: _showExportDialog,
child: const Icon(
CupertinoIcons.arrow_up_arrow_down_square_fill,
size: 28,
),
onPressed: _showExportDialog,
),
],
)
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/tab/view/quick_search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ class QuickSearchListPage extends StatelessWidget {
CupertinoButton(
minSize: 40,
padding: const EdgeInsets.all(0),
onPressed: _showFile,
child: const Icon(
FontAwesomeIcons.solidFileLines,
size: 20,
),
onPressed: _showFile,
),
if (Get.find<WebdavController>().syncQuickSearch)
CupertinoButton(
minSize: 40,
padding: const EdgeInsets.all(0),
onPressed: quickSearchController.syncQuickSearch,
child: const Icon(
FontAwesomeIcons.arrowsRotate,
size: 20,
),
onPressed: quickSearchController.syncQuickSearch,
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/tab/view/quick_search_page_o.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,21 @@ class QuickSearchListPage extends StatelessWidget {
CupertinoButton(
minSize: 40,
padding: const EdgeInsets.all(0),
onPressed: _showFile,
child: const Icon(
FontAwesomeIcons.solidFileLines,
size: 20,
),
onPressed: _showFile,
),
if (Get.find<WebdavController>().syncQuickSearch)
CupertinoButton(
minSize: 40,
padding: const EdgeInsets.all(0),
onPressed: quickSearchController.syncQuickSearch,
child: const Icon(
FontAwesomeIcons.arrowsRotate,
size: 20,
),
onPressed: quickSearchController.syncQuickSearch,
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/tab/view/search_image_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ImagePersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
final paddingTop = context.mediaQueryPadding.top;

return Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
border: _kDefaultNavBarBorder,
),
padding: EdgeInsets.only(top: paddingTop),
Expand Down Expand Up @@ -221,7 +221,7 @@ class ImagePersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
),
),
Container(
constraints: BoxConstraints(maxHeight: 80),
constraints: const BoxConstraints(maxHeight: 80),
child: CupertinoButton(
padding: const EdgeInsets.all(0.0),
child: Container(
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/tab/view/toplist_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class _ToplistTabState extends State<ToplistTab> {
CupertinoButton(
padding: const EdgeInsets.all(0.0),
minSize: 40,
child: Stack(
child: const Stack(
alignment: Alignment.centerRight,
// mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
Icon(
CupertinoIcons.sort_down,
size: 28,
Expand Down

0 comments on commit e6b3202

Please sign in to comment.