Skip to content

Commit

Permalink
redesign add substitute
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sidhdhi-p committed Oct 3, 2024
1 parent 25a4dd8 commit 2e41814
Show file tree
Hide file tree
Showing 26 changed files with 599 additions and 1,292 deletions.
25 changes: 0 additions & 25 deletions data/lib/service/ball_score/ball_score_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import '../../errors/app_error.dart';
import '../../extensions/double_extensions.dart';
import '../innings/inning_service.dart';
import '../match/match_service.dart';
import '../../storage/app_preferences.dart';
import '../../utils/constant/firestore_constant.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand All @@ -16,16 +15,12 @@ final ballScoreServiceProvider = Provider((ref) {
FirebaseFirestore.instance,
ref.read(matchServiceProvider),
ref.read(inningServiceProvider),
ref.read(currentUserPod)?.id,
);

ref.listen(currentUserPod, (_, next) => service._currentUserId = next?.id);
return service;
});

class BallScoreService {
String? _currentUserId;

final FirebaseFirestore _firestore;
final MatchService _matchService;
final InningsService _inningsService;
Expand All @@ -34,7 +29,6 @@ class BallScoreService {
this._firestore,
this._matchService,
this._inningsService,
this._currentUserId,
);

CollectionReference<BallScoreModel> get _ballScoreCollection =>
Expand Down Expand Up @@ -135,25 +129,6 @@ class BallScoreService {
.handleError((error, stack) => throw AppError.fromError(error, stack));
}

Stream<List<BallScoreModel>> streamCurrentUserRelatedBalls() {
if (_currentUserId == null) {
return Stream.value([]);
}

return _ballScoreCollection
.where(
Filter.or(
Filter(FireStoreConst.bowlerId, isEqualTo: _currentUserId),
Filter(FireStoreConst.batsmanId, isEqualTo: _currentUserId),
Filter(FireStoreConst.wicketTakerId, isEqualTo: _currentUserId),
Filter(FireStoreConst.playerOutId, isEqualTo: _currentUserId),
),
)
.snapshots()
.map((event) => event.docs.map((score) => score.data()).toList())
.handleError((error, stack) => throw AppError.fromError(error, stack));
}

Future<void> deleteBallAndUpdateTeamDetails({
required String ballId,
required String matchId,
Expand Down
24 changes: 0 additions & 24 deletions data/lib/service/match/match_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,6 @@ class MatchService {
}
}

Stream<List<MatchModel>> streamCurrentUserPlayedMatches() {
if (_currentUserId == null) {
return Stream.value([]);
}

final filter = Filter.and(
Filter(FireStoreConst.matchStatus, isEqualTo: MatchStatus.finish.value),
Filter(FireStoreConst.players, arrayContains: _currentUserId),
);

return _matchCollection
.where(filter)
.snapshots()
.asyncMap((snapshot) async {
return await Future.wait(
snapshot.docs.map((mainDoc) async {
final match = mainDoc.data();
final List<MatchTeamModel> teams = await getTeamsList(match.teams);
return match.copyWith(teams: teams);
}).toList(),
);
}).handleError((error, stack) => throw AppError.fromError(error, stack));
}

Stream<List<MatchModel>> streamCurrentUserRelatedMatches() {
if (_currentUserId == null) {
return Stream.value([]);
Expand Down
1 change: 1 addition & 0 deletions khelo/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
"team_detail_add_members_title": "Add members",
"team_detail_add_match_title": "Add match",
"team_detail_make_admin": "Make admin",
"make_admin_selection_error": "Can't select deactivated user as admin",
"team_detail_make_admin_screen_title": "Make Admin",
"team_detail_admin": "{count, plural, =0{{count} admins} =1{{count} admin} other{{count} admins}}",
"@team_detail_admin": {
Expand Down
4 changes: 2 additions & 2 deletions khelo/lib/ui/flow/main/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:khelo/domain/extensions/context_extensions.dart';
import 'package:khelo/gen/assets.gen.dart';
import 'package:khelo/ui/flow/my_game/my_game_tab_screen.dart';
import 'package:khelo/ui/flow/profile/profile_screen.dart';
import 'package:khelo/ui/flow/stats/my_stats_tab_screen.dart';
import 'package:khelo/ui/flow/stats/user_stat/user_stat_screen.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:style/extensions/context_extensions.dart';
import 'package:style/navigation/bottom_navigation_bar.dart';
Expand All @@ -31,7 +31,7 @@ class _MainScreenState extends ConsumerState<MainScreen>
static final List<Widget> _widgets = <Widget>[
const HomeScreen(),
const MyGameTabScreen(),
const MyStatsTabScreen(),
const UserStatScreen(),
const ProfileScreen(),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ class _AddMatchOfficialsScreenState
return Stack(
children: [
ListView(
padding: context.mediaQueryPadding + BottomStickyOverlay.padding,
padding: context.mediaQueryPadding +
BottomStickyOverlay.padding +
const EdgeInsets.only(bottom: 40),
children: [
for (final type in MatchOfficials.values) ...[
_sectionTitle(context, type.getTitle(context)),
_officialList(context, notifier, state, type),
],
const SizedBox(height: 40)
],
),
_stickyButton(context, state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class SearchUserBottomSheet extends ConsumerWidget {
final notifier = ref.watch(searchUserStateProvider.notifier);
final state = ref.watch(searchUserStateProvider);

return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: SizedBox(
height: context.mediaQuerySize.height * 0.8,
return SizedBox(
height: context.mediaQuerySize.height * 0.8,
child: Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Column(
children: [
_searchTextField(context, notifier, state),
Expand Down Expand Up @@ -73,6 +74,7 @@ class SearchUserBottomSheet extends ConsumerWidget {
isShowButton: false,
)
: ListView.separated(
padding: const EdgeInsets.only(top: 16, bottom: 40),
separatorBuilder: (context, index) {
return Divider(
color: context.colorScheme.outline,
Expand Down
Loading

0 comments on commit 2e41814

Please sign in to comment.