bug fixes
This commit is contained in:
parent
8666a6a740
commit
56a885a6ee
|
|
@ -3,7 +3,7 @@ name: app-dev
|
|||
spec:
|
||||
allow_http: false
|
||||
disable_default_domains: true
|
||||
image: app-dev:1.5.4
|
||||
image: app-dev:1.5.10
|
||||
image_pull_policy: IfNotPresent
|
||||
path: /
|
||||
replicas: 1
|
||||
|
|
|
|||
|
|
@ -58,24 +58,24 @@ class _HashtagState extends State<Hashtag> {
|
|||
return RadarOverview(
|
||||
radar: item,
|
||||
onCommentsChanged: (_, count) => item.comments = count,
|
||||
onMarkChanged: (_, value) => item.marked = value,
|
||||
onMarkChanged: (_, value, __) => item.marked = value,
|
||||
);
|
||||
case 'news':
|
||||
return NewsOverview(
|
||||
news: item,
|
||||
onMarkChanged: (_, value) => item.marked = value,
|
||||
onMarkChanged: (_, value, __) => item.marked = value,
|
||||
);
|
||||
case 'podcast':
|
||||
return PodcastOverview(
|
||||
podcast: item,
|
||||
onMarkChanged: (_, value) => item.marked = value,
|
||||
onMarkChanged: (_, value, __) => item.marked = value,
|
||||
studioRequestArgs:
|
||||
const StudioRequestArgs(page: 0, type: 'podcast'),
|
||||
);
|
||||
case 'video':
|
||||
return VideoOverview(
|
||||
video: item,
|
||||
onMarkChanged: (_, value) => item.marked = value,
|
||||
onMarkChanged: (_, value, __) => item.marked = value,
|
||||
studioRequestArgs:
|
||||
const StudioRequestArgs(page: 0, type: 'video'),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class _NewsState extends State<News> {
|
|||
final news = state.news[index];
|
||||
return NewsOverview(
|
||||
news: news,
|
||||
onMarkChanged: (id, value) => state.onMarkChanged(id, value),
|
||||
onMarkChanged: state.onMarkChanged,
|
||||
newsRequestArgs: NewsRequestArgs(
|
||||
page: state.page,
|
||||
endDate: state.endDate,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:didvan/models/enums.dart';
|
|||
import 'package:didvan/models/overview_data.dart';
|
||||
import 'package:didvan/models/requests/news.dart';
|
||||
import 'package:didvan/providers/core.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/services/network/request.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
|
||||
|
|
@ -69,10 +68,11 @@ class NewsState extends CoreProvier {
|
|||
appState = AppState.failed;
|
||||
}
|
||||
|
||||
Future<void> onMarkChanged(int id, bool value) async {
|
||||
Future<void> onMarkChanged(int id, bool value, bool shouldUpdate) async {
|
||||
news.firstWhere((element) => element.id == id).marked = value;
|
||||
notifyListeners();
|
||||
UserProvider.changeNewsMark(id, value);
|
||||
if (shouldUpdate) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
bool get isFiltering => startDate != null || endDate != null;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class _RadarState extends State<Radar> {
|
|||
final radar = state.radars[index];
|
||||
return RadarOverview(
|
||||
radar: radar,
|
||||
onMarkChanged: (id, value) => state.changeMark(id, value),
|
||||
onMarkChanged: state.changeMark,
|
||||
onCommentsChanged: (id, count) =>
|
||||
state.onCommentsChanged(id, count),
|
||||
radarRequestArgs: RadarRequestArgs(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import 'package:didvan/models/overview_data.dart';
|
|||
import 'package:didvan/models/requests/radar.dart';
|
||||
import 'package:didvan/models/view/radar_category.dart';
|
||||
import 'package:didvan/providers/core.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/services/network/request.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
|
||||
|
|
@ -82,10 +81,11 @@ class RadarState extends CoreProvier {
|
|||
appState = AppState.failed;
|
||||
}
|
||||
|
||||
Future<void> changeMark(int id, bool value) async {
|
||||
Future<void> changeMark(int id, bool value, bool shouldUpdate) async {
|
||||
radars.firstWhere((element) => element.id == id).marked = value;
|
||||
notifyListeners();
|
||||
UserProvider.changeRadarMark(id, value);
|
||||
if (shouldUpdate) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
void onCommentsChanged(int id, int count) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:didvan/models/enums.dart';
|
||||
import 'package:didvan/models/overview_data.dart';
|
||||
import 'package:didvan/providers/core.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/services/network/request.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
|
||||
|
|
@ -41,16 +40,6 @@ class BookmarksState extends CoreProvier {
|
|||
|
||||
void onMarkChanged(int id, bool value) {
|
||||
if (value) return;
|
||||
final type = bookmarks.firstWhere((element) => element.id == id).type;
|
||||
switch (type) {
|
||||
case 'radar':
|
||||
UserProvider.changeRadarMark(id, value);
|
||||
break;
|
||||
case 'news':
|
||||
UserProvider.changeNewsMark(id, value);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
bookmarks.removeWhere((element) => element.id == id);
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class _FilteredBookmarksState extends State<FilteredBookmarks> {
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> _onBookmarkChanged(int id, bool value) async {
|
||||
Future<void> _onBookmarkChanged(int id, bool value, bool shouldUpdate) async {
|
||||
if (value) return;
|
||||
final state = context.read<FilteredBookmarksState>();
|
||||
state.onMarkChanged(id, false);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:didvan/models/enums.dart';
|
||||
import 'package:didvan/models/overview_data.dart';
|
||||
import 'package:didvan/providers/core.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/services/network/request.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
|
||||
|
|
@ -45,13 +44,6 @@ class FilteredBookmarksState extends CoreProvier {
|
|||
}
|
||||
|
||||
void onMarkChanged(int id, bool value) {
|
||||
if (type == 'radar') {
|
||||
UserProvider.changeRadarMark(id, value);
|
||||
} else if (type == 'news') {
|
||||
UserProvider.changeNewsMark(id, value);
|
||||
} else {
|
||||
UserProvider.changeStudioMark(id, value);
|
||||
}
|
||||
bookmarks.removeWhere((element) => element.id == id);
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,9 +114,13 @@ class _StudioDetailsState extends State<StudioDetails> {
|
|||
? null
|
||||
: AppBarData(
|
||||
trailing: BookmarkButton(
|
||||
itemId: state.studio.id,
|
||||
type: 'video',
|
||||
value: state.studio.marked,
|
||||
onMarkChanged: (value) => widget
|
||||
.pageData['onMarkChanged'](state.studio.id, value),
|
||||
onMarkChanged: (value) {
|
||||
widget.pageData['onMarkChanged'](
|
||||
state.studio.id, value);
|
||||
},
|
||||
gestureSize: 48,
|
||||
),
|
||||
isSmall: true,
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ class _StudioDetailsState extends State<StudioDetails> {
|
|||
isSmall: true,
|
||||
title: state.studio.title,
|
||||
trailing: BookmarkButton(
|
||||
itemId: state.studio.id,
|
||||
type: 'video',
|
||||
value: state.studio.marked,
|
||||
onMarkChanged: (value) => widget
|
||||
.pageData['onMarkChanged'](state.studio.id, value),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:didvan/models/overview_data.dart';
|
|||
import 'package:didvan/models/requests/studio.dart';
|
||||
import 'package:didvan/models/slider_data.dart';
|
||||
import 'package:didvan/providers/core.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/services/network/request.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
|
||||
|
|
@ -111,10 +110,11 @@ class StudioState extends CoreProvier {
|
|||
appState = AppState.failed;
|
||||
}
|
||||
|
||||
Future<void> changeMark(int id, bool value) async {
|
||||
Future<void> changeMark(int id, bool value, bool shouldUpdate) async {
|
||||
studios.firstWhere((element) => element.id == id).marked = value;
|
||||
notifyListeners();
|
||||
UserProvider.changeStudioMark(id, value);
|
||||
if (shouldUpdate) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
void onCommentsChanged(int id, int count) {
|
||||
|
|
|
|||
|
|
@ -168,12 +168,14 @@ class AudioPlayerWidget extends StatelessWidget {
|
|||
Expanded(
|
||||
child: Center(
|
||||
child: BookmarkButton(
|
||||
itemId: state.studio.id,
|
||||
type: 'podcast',
|
||||
gestureSize: 48,
|
||||
color: Theme.of(context).colorScheme.title,
|
||||
value: podcast.marked,
|
||||
onMarkChanged: (value) => context
|
||||
.read<StudioState>()
|
||||
.changeMark(podcast.id, value),
|
||||
.changeMark(podcast.id, value, true),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:didvan/config/design_config.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
import 'package:didvan/utils/action_sheet.dart';
|
||||
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
|
|
@ -12,12 +13,16 @@ class BookmarkButton extends StatefulWidget {
|
|||
final void Function(bool value) onMarkChanged;
|
||||
final bool askForConfirmation;
|
||||
final double gestureSize;
|
||||
final String type;
|
||||
final int itemId;
|
||||
const BookmarkButton({
|
||||
Key? key,
|
||||
required this.value,
|
||||
required this.onMarkChanged,
|
||||
this.askForConfirmation = false,
|
||||
required this.gestureSize,
|
||||
required this.type,
|
||||
required this.itemId,
|
||||
this.askForConfirmation = false,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
|
||||
|
|
@ -69,6 +74,21 @@ class _BookmarkButtonState extends State<BookmarkButton> {
|
|||
_value = !_value;
|
||||
});
|
||||
widget.onMarkChanged(_value);
|
||||
switch (widget.type) {
|
||||
case 'radar':
|
||||
UserProvider.changeRadarMark(widget.itemId, _value);
|
||||
break;
|
||||
case 'news':
|
||||
UserProvider.changeNewsMark(widget.itemId, _value);
|
||||
break;
|
||||
case 'podcast':
|
||||
UserProvider.changeStudioMark(widget.itemId, _value);
|
||||
break;
|
||||
case 'video':
|
||||
UserProvider.changeStudioMark(widget.itemId, _value);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
|||
const Spacer(),
|
||||
if (widget.isRadar)
|
||||
BookmarkButton(
|
||||
itemId: widget.item.id,
|
||||
type: 'radar',
|
||||
color: DesignConfig.isDark
|
||||
? Theme.of(context).colorScheme.focusedBorder
|
||||
: Theme.of(context).colorScheme.focused,
|
||||
|
|
@ -146,6 +148,8 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
|||
if (!widget.isRadar) const SizedBox(width: 12),
|
||||
if (!widget.isRadar)
|
||||
BookmarkButton(
|
||||
itemId: widget.item.id,
|
||||
type: 'news',
|
||||
color: DesignConfig.isDark
|
||||
? Theme.of(context).colorScheme.focusedBorder
|
||||
: Theme.of(context).colorScheme.focused,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
|
|||
class NewsOverview extends StatelessWidget {
|
||||
final OverviewData news;
|
||||
final NewsRequestArgs? newsRequestArgs;
|
||||
final void Function(int id, bool value) onMarkChanged;
|
||||
final void Function(int id, bool value, bool shouldUpdate) onMarkChanged;
|
||||
final bool hasUnmarkConfirmation;
|
||||
const NewsOverview({
|
||||
Key? key,
|
||||
|
|
@ -29,7 +29,7 @@ class NewsOverview extends StatelessWidget {
|
|||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.newsDetails,
|
||||
arguments: {
|
||||
'onMarkChanged': onMarkChanged,
|
||||
'onMarkChanged': (id, value) => onMarkChanged(id, value, true),
|
||||
'id': news.id,
|
||||
'args': newsRequestArgs,
|
||||
'hasUnmarkConfirmation': hasUnmarkConfirmation,
|
||||
|
|
@ -79,9 +79,11 @@ class NewsOverview extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
BookmarkButton(
|
||||
itemId: news.id,
|
||||
type: 'news',
|
||||
gestureSize: 32,
|
||||
value: news.marked,
|
||||
onMarkChanged: (value) => onMarkChanged(news.id, value),
|
||||
onMarkChanged: (value) => onMarkChanged(news.id, value, false),
|
||||
askForConfirmation: hasUnmarkConfirmation,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class PodcastOverview extends StatelessWidget {
|
||||
final OverviewData podcast;
|
||||
final void Function(int id, bool value) onMarkChanged;
|
||||
final void Function(int id, bool value, bool shouldUpdate) onMarkChanged;
|
||||
final StudioRequestArgs studioRequestArgs;
|
||||
final bool hasUnmarkConfirmation;
|
||||
const PodcastOverview({
|
||||
|
|
@ -112,10 +112,13 @@ class PodcastOverview extends StatelessWidget {
|
|||
const SizedBox(width: 16),
|
||||
],
|
||||
BookmarkButton(
|
||||
itemId: podcast.id,
|
||||
type: 'podcast',
|
||||
askForConfirmation: hasUnmarkConfirmation,
|
||||
gestureSize: 32,
|
||||
value: podcast.marked,
|
||||
onMarkChanged: (value) => onMarkChanged(podcast.id, value),
|
||||
onMarkChanged: (value) =>
|
||||
onMarkChanged(podcast.id, value, false),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import 'package:flutter/material.dart';
|
|||
class RadarOverview extends StatelessWidget {
|
||||
final OverviewData radar;
|
||||
final void Function(int id, int count) onCommentsChanged;
|
||||
final void Function(int id, bool value) onMarkChanged;
|
||||
final void Function(int id, bool value, bool shouldUpdate) onMarkChanged;
|
||||
final bool hasUnmarkConfirmation;
|
||||
final RadarRequestArgs? radarRequestArgs;
|
||||
const RadarOverview({
|
||||
|
|
@ -34,7 +34,7 @@ class RadarOverview extends StatelessWidget {
|
|||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.radarDetails,
|
||||
arguments: {
|
||||
'onMarkChanged': onMarkChanged,
|
||||
'onMarkChanged': (id, value) => onMarkChanged(id, value, true),
|
||||
'onCommentsChanged': onCommentsChanged,
|
||||
'id': radar.id,
|
||||
'args': radarRequestArgs,
|
||||
|
|
@ -124,9 +124,11 @@ class RadarOverview extends StatelessWidget {
|
|||
// const Icon(DidvanIcons.evaluation_regular),
|
||||
const Spacer(),
|
||||
BookmarkButton(
|
||||
itemId: radar.id,
|
||||
type: 'radar',
|
||||
gestureSize: 32,
|
||||
value: radar.marked,
|
||||
onMarkChanged: (value) => onMarkChanged(radar.id, value),
|
||||
onMarkChanged: (value) => onMarkChanged(radar.id, value, false),
|
||||
askForConfirmation: hasUnmarkConfirmation,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class VideoOverview extends StatelessWidget {
|
||||
final OverviewData video;
|
||||
final void Function(int id, bool value) onMarkChanged;
|
||||
final void Function(int id, bool value, bool shouldUpdate) onMarkChanged;
|
||||
final bool hasUnmarkConfirmation;
|
||||
final StudioRequestArgs studioRequestArgs;
|
||||
const VideoOverview({
|
||||
|
|
@ -32,7 +32,7 @@ class VideoOverview extends StatelessWidget {
|
|||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.studioDetails,
|
||||
arguments: {
|
||||
'onMarkChanged': onMarkChanged,
|
||||
'onMarkChanged': (id, value) => onMarkChanged(id, value, true),
|
||||
'id': video.id,
|
||||
'args': studioRequestArgs,
|
||||
'hasUnmarkConfirmation': hasUnmarkConfirmation,
|
||||
|
|
@ -101,9 +101,12 @@ class VideoOverview extends StatelessWidget {
|
|||
// ),
|
||||
// const SizedBox(width: 16),
|
||||
BookmarkButton(
|
||||
itemId: video.id,
|
||||
type: 'video',
|
||||
gestureSize: 32,
|
||||
value: video.marked,
|
||||
onMarkChanged: (value) => onMarkChanged(video.id, value),
|
||||
onMarkChanged: (value) =>
|
||||
onMarkChanged(video.id, value, false),
|
||||
askForConfirmation: hasUnmarkConfirmation,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:universal_html/js.dart' as js;
|
||||
|
||||
class Splash extends StatefulWidget {
|
||||
const Splash({Key? key}) : super(key: key);
|
||||
|
|
|
|||
Loading…
Reference in New Issue