|
|
@@ -17,10 +17,8 @@ import '../../resource/string.gen.dart';
|
|
|
import '../../utils/styles.dart';
|
|
|
|
|
|
class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
-
|
|
|
final KeyboardInfo currentKeyboardInfo;
|
|
|
|
|
|
-
|
|
|
@override
|
|
|
String? get tag => "CustomCharacterAddController${currentKeyboardInfo.id}";
|
|
|
|
|
|
@@ -32,50 +30,49 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
@override
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
Get.delete<CustomCharacterAddController>(tag: tag);
|
|
|
- Get.put(CustomCharacterAddController(
|
|
|
+ Get.put(
|
|
|
+ CustomCharacterAddController(
|
|
|
getIt.get<CharactersRepository>(),
|
|
|
getIt.get<KeyboardRepository>(),
|
|
|
- currentKeyboardInfo: currentKeyboardInfo),
|
|
|
- tag: tag);
|
|
|
- return Column(
|
|
|
- children: [
|
|
|
-
|
|
|
- Expanded(
|
|
|
- child: Obx(() {
|
|
|
- return EasyRefresh(
|
|
|
- controller: controller.refreshController,
|
|
|
- header: const ClassicHeader(),
|
|
|
- footer: ClassicFooter(
|
|
|
- showMessage: false,
|
|
|
- noMoreText: StringName.noMoreData,
|
|
|
- failedText: StringName.loadFailed,
|
|
|
- processedText: StringName.loadCompleted,
|
|
|
- processingText: StringName.loading,
|
|
|
- ),
|
|
|
+ currentKeyboardInfo: currentKeyboardInfo,
|
|
|
+ ),
|
|
|
+ tag: tag,
|
|
|
+ );
|
|
|
+ return Obx(() {
|
|
|
+ if (controller.characterList.isEmpty) {
|
|
|
+ return _buildCustomListEmpty();
|
|
|
+ }
|
|
|
+ return EasyRefresh(
|
|
|
+ controller: controller.refreshController,
|
|
|
+ header: const ClassicHeader(),
|
|
|
+ footer: ClassicFooter(
|
|
|
+ showMessage: false,
|
|
|
+ noMoreText: StringName.noMoreData,
|
|
|
+ failedText: StringName.loadFailed,
|
|
|
+ processedText: StringName.loadCompleted,
|
|
|
+ processingText: StringName.loading,
|
|
|
+ ),
|
|
|
|
|
|
- // onRefresh: controller.refreshData,
|
|
|
- onLoad: controller.loadMoreData,
|
|
|
- child: ListView.separated(
|
|
|
- padding: EdgeInsets.zero,
|
|
|
- itemCount: controller.characterList.length,
|
|
|
- itemBuilder: (context, index) {
|
|
|
- return _buildListItem(
|
|
|
- characterInfo: controller.characterList[index],
|
|
|
- );
|
|
|
- },
|
|
|
- separatorBuilder: (BuildContext context, int index) {
|
|
|
- return SizedBox(
|
|
|
- width: double.infinity,
|
|
|
- height: 10.h,
|
|
|
- child: Container(color: const Color(0xFFF4F2FB)),
|
|
|
- );
|
|
|
- },
|
|
|
- ),
|
|
|
+ // onRefresh: controller.refreshData,
|
|
|
+ onLoad: controller.loadMoreData,
|
|
|
+ child: ListView.separated(
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ itemCount: controller.characterList.length,
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ return _buildListItem(
|
|
|
+ characterInfo: controller.characterList[index],
|
|
|
+ );
|
|
|
+ },
|
|
|
+ separatorBuilder: (BuildContext context, int index) {
|
|
|
+ return SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ height: 10.h,
|
|
|
+ child: Container(color: const Color(0xFFF4F2FB)),
|
|
|
);
|
|
|
- }),
|
|
|
+ },
|
|
|
),
|
|
|
- ],
|
|
|
- );
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
Widget _buildListItem({required CharacterInfo characterInfo}) {
|
|
|
@@ -104,7 +101,6 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// 角色头像
|
|
|
Widget _buildAvatar({required String? imageUrl}) {
|
|
|
return Container(
|
|
|
@@ -118,11 +114,20 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
colors: [Color(0xffebe6ff), Color(0xffffe6fe)],
|
|
|
),
|
|
|
),
|
|
|
- child: CachedNetworkImage(
|
|
|
- imageUrl: imageUrl ?? "",
|
|
|
- width: 60.r,
|
|
|
- height: 60.r,
|
|
|
- fit: BoxFit.cover,
|
|
|
+ child: ClipRRect(
|
|
|
+ borderRadius: BorderRadius.circular(8.r),
|
|
|
+ child: CachedNetworkImage(
|
|
|
+ imageUrl: imageUrl ?? "",
|
|
|
+ width: 60.r,
|
|
|
+ height: 60.r,
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ errorWidget:
|
|
|
+ (_, __, ___) => Assets.images.iconSystemKeyboard.image(
|
|
|
+ width: 60.r,
|
|
|
+ height: 60.r,
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
@@ -147,9 +152,9 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
SizedBox(width: 4.w),
|
|
|
characterInfo.isVip == true
|
|
|
? Assets.images.iconCharacterVip.image(
|
|
|
- width: 38.w,
|
|
|
- height: 16.h,
|
|
|
- )
|
|
|
+ width: 38.w,
|
|
|
+ height: 16.h,
|
|
|
+ )
|
|
|
: Container(),
|
|
|
],
|
|
|
),
|
|
|
@@ -180,13 +185,13 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.circular(50.r),
|
|
|
gradient:
|
|
|
- characterInfo.isAdd == true
|
|
|
- ? null
|
|
|
- : const LinearGradient(
|
|
|
- colors: [Color(0xFF7D46FC), Color(0xFFBC87FF)],
|
|
|
- begin: Alignment.topLeft,
|
|
|
- end: Alignment.bottomRight,
|
|
|
- ),
|
|
|
+ characterInfo.isAdd == true
|
|
|
+ ? null
|
|
|
+ : const LinearGradient(
|
|
|
+ colors: [Color(0xFF7D46FC), Color(0xFFBC87FF)],
|
|
|
+ begin: Alignment.topLeft,
|
|
|
+ end: Alignment.bottomRight,
|
|
|
+ ),
|
|
|
color: characterInfo.isAdd == true ? const Color(0xFFEDE8FF) : null,
|
|
|
),
|
|
|
child: Row(
|
|
|
@@ -208,9 +213,9 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
: StringName.characterAdd,
|
|
|
style: TextStyle(
|
|
|
color:
|
|
|
- characterInfo.isAdd == true
|
|
|
- ? const Color(0xFF7D46FC)
|
|
|
- : Colors.white,
|
|
|
+ characterInfo.isAdd == true
|
|
|
+ ? const Color(0xFF7D46FC)
|
|
|
+ : Colors.white,
|
|
|
fontSize: 14.sp,
|
|
|
fontWeight: FontWeight.w500,
|
|
|
),
|
|
|
@@ -220,4 +225,27 @@ class CustomCharacterAddView extends BaseView<CustomCharacterAddController> {
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ Widget _buildCustomListEmpty() {
|
|
|
+ return Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 100.w),
|
|
|
+ Assets.images.iconCharacterCustomListEmpty.image(
|
|
|
+ width: 161.w,
|
|
|
+ height: 139.w,
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ StringName.characterCustomListEmpty,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(178),
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+ ],
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|