dial_preview_card.dart
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'watch_face_preview.dart';
import 'watch_theme_section_card.dart';
class DialPreviewCard extends StatelessWidget {
bool showFriend;
final String? themeImageUrl;
final String? themeImageUrl2;
DialPreviewCard(
{super.key,
required this.showFriend,
this.themeImageUrl,
this.themeImageUrl2});
@override
Widget build(BuildContext context) {
return WatchThemeSectionCard(
padding: EdgeInsets.fromLTRB(0, 20, 0, 27),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const WatchThemeSectionTitle('表盘预览').paddingOnly(left: 20),
SizedBox(height: 16),
SizedBox(
height: showFriend ? 172 : 136,
child: ListView.separated(
padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
if (index == 0) {
return WatchFacePreview(
type: WatchFacePreviewType.surface,
themeImageUrl: themeImageUrl,
);
} else if (showFriend && index == 1) {
return WatchFacePreview(
type: WatchFacePreviewType.coupleSmall,
themeImageUrl: themeImageUrl,
themeImageUrl2: themeImageUrl2,
);
}
return WatchFacePreview(
type: WatchFacePreviewType.singleSmall,
themeImageUrl: themeImageUrl,
);
},
separatorBuilder: (context, index) => SizedBox(width: 12),
itemCount: showFriend ? 3 : 2,
),
),
],
),
);
}
}