Commit af9130eddd132592af9762066134259a2ab29e2e

Authored by 权海
1 parent 471b4a3c

feat(ui):修改主题页面自定义主题排列

import 'package:flutter/material.dart';
import 'package:get/utils.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import '../models/watch_theme_models.dart';
... ... @@ -51,28 +50,27 @@ class CustomThemeCard extends StatelessWidget {
_CreateThemeButton(onTap: onCreateTap),
customThemes.isEmpty
? SizedBox(height: 0)
: SizedBox(
height: 112,
child: ListView.separated(
scrollDirection: Axis.vertical,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return _CustomThemeItem(
item: customThemes[index],
selected: customThemes[index].id != null &&
customThemes[index].id == activeThemeId,
onTap: onThemeTap == null
? null
: () => onThemeTap!(customThemes[index]),
);
},
separatorBuilder: (context, index) {
return SizedBox(
width: 20,
);
},
itemCount: customThemes.length),
).paddingOnly(top: 12),
: GridView.builder(
shrinkWrap: true,
padding: const EdgeInsets.only(top: 12),
physics: const NeverScrollableScrollPhysics(),
itemCount: customThemes.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
mainAxisExtent: 114,
),
itemBuilder: (context, index) {
final theme = customThemes[index];
return _CustomThemeItem(
item: theme,
selected: theme.id != null && theme.id == activeThemeId,
onTap:
onThemeTap == null ? null : () => onThemeTap!(theme),
);
},
),
],
),
);
... ... @@ -152,34 +150,32 @@ class _CustomThemeItem extends StatelessWidget {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
child: SizedBox(
width: 88,
child: Column(
children: [
WatchThemeSelectedView(
selected: selected,
child: Column(
children: [
WatchThemeSelectedView(
selected: selected,
size: 88,
child: WatchThemeCharacterAvatar(
size: 88,
child: WatchThemeCharacterAvatar(
size: 88,
assetPath: item.infoList.firstOrNull?.assetPath,
imageUrl: item.infoList.firstOrNull?.imgUrl,
empty: item.infoList.firstOrNull?.image == null,
),
assetPath: item.infoList.firstOrNull?.assetPath,
imageUrl: item.infoList.firstOrNull?.imgUrl,
empty: item.infoList.firstOrNull?.image == null,
),
SizedBox(height: 8),
Text(
item.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: WatchThemeColors.textPrimary,
fontSize: 12,
fontWeight: FontWeight.w400,
height: 1.25,
),
),
SizedBox(height: 8),
Text(
item.title,
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: WatchThemeColors.textPrimary,
fontSize: 12,
fontWeight: FontWeight.w400,
height: 1.25,
),
],
),
),
],
),
);
}
... ...