Skip to content

Commit 1f132e6

Browse files
committed
feat: hidden media section
1 parent e7f54fe commit 1f132e6

File tree

9 files changed

+252
-88
lines changed

9 files changed

+252
-88
lines changed

lib/Adaptor/Media/Widgets/MediaSection.dart

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Widget MediaSection({
1212
List<Widget>? customNullListIndicator,
1313
ScrollController? scrollController,
1414
Function(int index, Media media)? onMediaTap,
15+
void Function()? onLongPressTitle,
1516
}) {
1617
var theme = Theme.of(context);
1718

@@ -23,15 +24,18 @@ Widget MediaSection({
2324
children: [
2425
// Title Text
2526
Expanded(
26-
child: Text(
27-
title,
28-
maxLines: 1,
29-
overflow: TextOverflow.ellipsis,
30-
style: TextStyle(
31-
fontFamily: 'Poppins',
32-
color: theme.colorScheme.onSurface,
33-
fontSize: 16,
34-
fontWeight: FontWeight.w600,
27+
child: GestureDetector(
28+
onLongPress: onLongPressTitle,
29+
child: Text(
30+
title,
31+
maxLines: 1,
32+
overflow: TextOverflow.ellipsis,
33+
style: TextStyle(
34+
fontFamily: 'Poppins',
35+
color: theme.colorScheme.onSurface,
36+
fontSize: 16,
37+
fontWeight: FontWeight.w600,
38+
),
3539
),
3640
),
3741
),

lib/DataClass/MediaSection.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class MediaSectionData {
1212
final bool isLarge;
1313
final ScrollController? scrollController;
1414
void Function()? emptyButtonOnPressed;
15+
void Function()? onLongPressTitle;
1516

1617
MediaSectionData({
1718
required this.type,
@@ -23,5 +24,6 @@ class MediaSectionData {
2324
this.emptyMessage,
2425
this.emptyButtonText,
2526
this.emptyButtonOnPressed,
27+
this.onLongPressTitle,
2628
});
2729
}

lib/Preferences/Preferences.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ class PrefName {
4242
'Planned Manga': true,
4343
'Dropped Manga': false,
4444
});
45-
static const Pref<Set<int>> removeList =
46-
Pref(Location.General, 'removeList', {});
47-
45+
static const Pref<List<int>> anilistRemoveList =
46+
Pref(Location.General, 'removeList', []);
47+
static const Pref<List<int>> malRemoveList =
48+
Pref(Location.General, 'removeList', []);
4849
//anime page
4950
static const Pref<Map<String, bool>> anilistAnimeLayout =
5051
Pref(Location.General, 'animeLayoutOrder', {

lib/Screens/Home/HomeScreen.dart

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,123 @@ class HomeScreenState extends State<HomeScreen> {
194194
);
195195
}
196196

197+
void contactPage(BuildContext context) {
198+
var theme = Theme.of(context).colorScheme;
199+
var t = CustomBottomDialog(
200+
title: 'Contact Us',
201+
viewList: [
202+
Padding(
203+
padding: const EdgeInsets.all(16.0),
204+
child: Column(
205+
crossAxisAlignment: CrossAxisAlignment.start,
206+
children: [
207+
Text(
208+
'Name',
209+
style: TextStyle(
210+
fontWeight: FontWeight.bold,
211+
color: theme.onPrimaryContainer,
212+
fontFamily: 'Poppins',
213+
),
214+
),
215+
const SizedBox(height: 8.0),
216+
TextField(
217+
decoration: InputDecoration(
218+
hintText: 'Enter your name',
219+
hintStyle: const TextStyle(
220+
fontWeight: FontWeight.w600,
221+
fontFamily: 'Poppins',
222+
),
223+
border: OutlineInputBorder(
224+
borderRadius: BorderRadius.circular(16.0),
225+
),
226+
prefixIcon: const Icon(Icons.person),
227+
),
228+
),
229+
const SizedBox(height: 16.0),
230+
Text(
231+
'Email',
232+
style: TextStyle(
233+
fontWeight: FontWeight.bold,
234+
color: theme.onPrimaryContainer,
235+
),
236+
),
237+
const SizedBox(height: 8.0),
238+
TextField(
239+
decoration: InputDecoration(
240+
hintText: 'Enter your email',
241+
hintStyle: const TextStyle(
242+
fontWeight: FontWeight.w600,
243+
fontFamily: 'Poppins',
244+
),
245+
border: OutlineInputBorder(
246+
borderRadius: BorderRadius.circular(16.0),
247+
),
248+
prefixIcon: const Icon(Icons.email),
249+
),
250+
),
251+
const SizedBox(height: 16.0),
252+
Text(
253+
'Message',
254+
style: TextStyle(
255+
fontWeight: FontWeight.bold,
256+
color: theme.onPrimaryContainer,
257+
),
258+
),
259+
const SizedBox(height: 8.0),
260+
TextField(
261+
maxLines: 4,
262+
decoration: InputDecoration(
263+
hintText: 'Write your message here...',
264+
hintStyle: const TextStyle(
265+
fontWeight: FontWeight.w600,
266+
fontFamily: 'Poppins',
267+
),
268+
border: OutlineInputBorder(
269+
borderRadius: BorderRadius.circular(16.0),
270+
),
271+
//prefixIcon: const Icon(Icons.message),
272+
),
273+
),
274+
const SizedBox(height: 24.0),
275+
Center(
276+
child: ElevatedButton.icon(
277+
onPressed: () {},
278+
icon: const Padding(
279+
padding: EdgeInsets.only(left: 6.0),
280+
child: Icon(Icons.send),
281+
),
282+
iconAlignment: IconAlignment.end,
283+
label: Text(
284+
'Submit',
285+
style: TextStyle(
286+
fontFamily: 'Poppins',
287+
color: theme.onPrimaryContainer,
288+
fontWeight: FontWeight.bold,
289+
),
290+
),
291+
style: ElevatedButton.styleFrom(
292+
backgroundColor: theme.primaryContainer,
293+
padding: const EdgeInsets.only(
294+
top: 26,
295+
bottom: 26,
296+
left: 24,
297+
right: 42,
298+
),
299+
shape: RoundedRectangleBorder(
300+
borderRadius: BorderRadius.circular(16),
301+
),
302+
),
303+
),
304+
),
305+
],
306+
),
307+
),
308+
],
309+
);
310+
311+
showCustomBottomDialog(context, t);
312+
}
313+
197314
Widget _buildUserInfo(BaseServiceData data) {
198315
final theme = Theme.of(context).colorScheme;
199316
final isDarkMode = Provider.of<ThemeNotifier>(context).isDarkMode;
@@ -204,7 +321,7 @@ class HomeScreenState extends State<HomeScreen> {
204321
child: SlideUpAnimation(
205322
child: Row(children: [
206323
GestureDetector(
207-
onTap: () {},
324+
onTap: () => contactPage(context),
208325
child: CircleAvatar(
209326
backgroundColor: Colors.transparent,
210327
radius: 26.0,

lib/Screens/Settings/SettingsAccountScreen.dart

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:dantotsu/Screens/Settings/BaseSettingsScreen.dart';
33
import 'package:flutter/material.dart';
44
import 'package:get/get.dart';
55

6-
import '../../Functions/Function.dart';
76
import '../../Theme/LanguageSwitcher.dart';
87
import '../../Widgets/AlertDialogBuilder.dart';
98
import '../../Widgets/LoadSvg.dart';
@@ -33,10 +32,7 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
3332
);
3433

3534
@override
36-
List<Widget> get settingsList => [
37-
..._buildSettings(context),
38-
const SizedBox(height: 42),
39-
];
35+
List<Widget> get settingsList => _buildSettings(context);
4036

4137
List<Widget> _buildSettings(BuildContext context) {
4238
return [
@@ -54,9 +50,6 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
5450
..setNegativeButton('No', null)
5551
..show(),
5652
onLogIn: () => Anilist.login(context),
57-
onAvatarTap: () => snackString('Avatar Tapped'),
58-
onIconTap: () => snackString('Edit Icon Tapped'),
59-
onIconLongTap: () => snackString('Long Pressed'),
6053
),
6154
_buildAccountSection(
6255
context,
@@ -72,9 +65,6 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
7265
..setNegativeButton('No', null)
7366
..show(),
7467
onLogIn: () => Mal.login(context),
75-
onAvatarTap: () => snackString('Avatar Tapped'),
76-
onIconTap: () => snackString('Edit Icon Tapped'),
77-
onIconLongTap: () => snackString('Long Pressed'),
7868
),
7969
const SizedBox(height: 16),
8070
_buildAccountSection(
@@ -91,9 +81,6 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
9181
..setNegativeButton('No', null)
9282
..show(),
9383
onLogIn: () => Discord.warning(context),
94-
onAvatarTap: () => snackString('Discord Avatar Tapped'),
95-
onIconTap: () => snackString('Discord Edit Icon Tapped'),
96-
onIconLongTap: () => snackString('Discord Long Pressed'),
9784
),
9885
];
9986
}
@@ -108,20 +95,14 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
10895
required RxString avatarUrl,
10996
required Function() onLogOut,
11097
required Function() onLogIn,
111-
required Function() onAvatarTap,
112-
required Function() onIconTap,
113-
required Function() onIconLongTap,
98+
Function()? onAvatarTap,
99+
Function()? onIconTap,
100+
Function()? onIconLongTap,
114101
}) {
115102
var theme = Theme.of(context).colorScheme;
116103

117104
final leadingIcon = iconPath != null
118-
? loadSvg(
119-
iconPath,
120-
width: 26,
121-
height: 26,
122-
// ignore: deprecated_member_use
123-
color: theme.primary,
124-
)
105+
? loadSvg(iconPath, width: 26, height: 26, color: theme.primary)
125106
: icon!;
126107

127108
return Obx(() => isLoggedIn.value.isNotEmpty
@@ -137,8 +118,8 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
137118
RxString username,
138119
RxString avatarUrl,
139120
Function() onPressed,
140-
Function() onAvatarTap,
141-
Function() onIconTap,
121+
Function()? onAvatarTap,
122+
Function()? onIconTap,
142123
Function()? onIconLongTap,
143124
) {
144125
var theme = Theme.of(context).colorScheme;
@@ -170,22 +151,23 @@ class SettingsAccountScreenState extends BaseSettingsScreen {
170151
]),
171152
Row(
172153
children: [
173-
GestureDetector(
174-
onTap: onIconTap,
175-
onLongPress: onIconLongTap,
176-
child: Container(
177-
padding: const EdgeInsets.all(8.0),
178-
decoration: BoxDecoration(
179-
shape: BoxShape.circle,
180-
color: theme.primary,
181-
),
182-
child: Icon(
183-
Icons.question_mark, // Small icon
184-
size: 14,
185-
color: theme.surface,
154+
if (onIconTap != null || onIconLongTap != null)
155+
GestureDetector(
156+
onTap: onIconTap,
157+
onLongPress: onIconLongTap,
158+
child: Container(
159+
padding: const EdgeInsets.all(8.0),
160+
decoration: BoxDecoration(
161+
shape: BoxShape.circle,
162+
color: theme.primary,
163+
),
164+
child: Icon(
165+
Icons.question_mark, // Small icon
166+
size: 14,
167+
color: theme.surface,
168+
),
186169
),
187170
),
188-
),
189171
const SizedBox(width: 8),
190172
GestureDetector(
191173
onTap: onAvatarTap,

lib/api/Anilist/AnilistQueries/GetHomePageData.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ part of '../AnilistQueries.dart';
33
extension on AnilistQueries {
44
Future<Map<String, List<Media>>> _initHomePage() async {
55
try {
6-
final removeList = PrefManager.getVal(PrefName.removeList);
6+
final removeList = PrefManager.getVal(PrefName.anilistRemoveList);
77
const hidePrivate = true;
88
List<Media> removedMedia = [];
99
final homeLayoutMap = PrefManager.getVal(PrefName.anilistHomeLayout);

0 commit comments

Comments
 (0)