logo和名称替换
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
|
||||
import '../../assets_tool/app_colors.dart';
|
||||
import '../../hj_utils/api_service/acg_service.dart';
|
||||
import '../../hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import '../../hj_utils/widget_util.dart';
|
||||
|
||||
enum FollowEnum {
|
||||
@@ -64,7 +64,9 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
child: isLoading
|
||||
? _loading()
|
||||
: Image.asset(
|
||||
isFollow ? 'collect_red.png'.commonImgPath : 'collect_path.png'.commonImgPath,
|
||||
isFollow
|
||||
? 'collect_red.png'.commonImgPath
|
||||
: 'collect_path.png'.commonImgPath,
|
||||
width: 24,
|
||||
),
|
||||
);
|
||||
@@ -86,11 +88,17 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
isLoading ? _loading() : const Icon(Icons.check, size: 14, color: Color(0xff989898)),
|
||||
isLoading
|
||||
? _loading()
|
||||
: const Icon(Icons.check,
|
||||
size: 14, color: Color(0xff989898)),
|
||||
4.sizeBoxW,
|
||||
const Text(
|
||||
'关注',
|
||||
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w500, color: Color(0xff989898)),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xff989898)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -104,11 +112,17 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
isLoading ? _loading() : const Icon(Icons.add, size: 14, color: AppColors.actionRed),
|
||||
isLoading
|
||||
? _loading()
|
||||
: const Icon(Icons.add,
|
||||
size: 14, color: AppColors.actionRed),
|
||||
4.sizeBoxW,
|
||||
const Text(
|
||||
'关注',
|
||||
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w500, color: AppColors.actionRed),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.actionRed),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -132,20 +146,25 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
child: isFollow
|
||||
? Text('已收藏', style: textStyle(10, Colors.white, FontWeight.w400))
|
||||
? Text('已收藏',
|
||||
style: textStyle(10, Colors.white, FontWeight.w400))
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset('add_red.png'.commonImgPath, width: 16, color: Colors.black),
|
||||
Image.asset('add_red.png'.commonImgPath,
|
||||
width: 16, color: Colors.black),
|
||||
2.sizeBoxW,
|
||||
Text('收藏', style: textStyle(10, Colors.black, FontWeight.w400)),
|
||||
Text('收藏',
|
||||
style:
|
||||
textStyle(10, Colors.black, FontWeight.w400)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _loading() => const CupertinoActivityIndicator(color: Colors.white, radius: 8);
|
||||
Widget _loading() =>
|
||||
const CupertinoActivityIndicator(color: Colors.white, radius: 8);
|
||||
|
||||
//加入书架 / 取消收藏
|
||||
void _onCollectTap() => isFollow ? _unCollect() : _collect();
|
||||
@@ -153,7 +172,8 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
void _unCollect() async {
|
||||
if (isLoading) return;
|
||||
setState(() => isLoading = true);
|
||||
if (await ACGService.deleteBookshelf(mediaId ?? '')) widget.onSuccess?.call(false);
|
||||
if (await ACGService.deleteBookshelf(mediaId ?? ''))
|
||||
widget.onSuccess?.call(false);
|
||||
isLoading = false;
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
@@ -161,7 +181,8 @@ class _FollowButtonState extends State<FollowButton> {
|
||||
void _collect() async {
|
||||
if (isLoading) return;
|
||||
setState(() => isLoading = true);
|
||||
if (await ACGService.addBookshelf(mediaId ?? '')) widget.onSuccess?.call(true);
|
||||
if (await ACGService.addBookshelf(mediaId ?? ''))
|
||||
widget.onSuccess?.call(true);
|
||||
isLoading = false;
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user