This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Important rules you HAVE TO FOLLOW | |
| - Always add debug logs & comments in the code for easier debug & readability | |
| - Every time you choose to apply a rule(s), explicitly state the rule{s} in the output. You can abbreviate the rule description to a single word or phrase | |
| - Do not make any changes, until you have 95% confidence that you know what to build. Ask me follow up questions until you have that confidence. | |
| # Project structure | |
| - All the files go inside /tip tracker | |
| - The main swift file is tip_trackerApp.swift | |
| # Tech Stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MovieListPage extends StatelessWidget { | |
| const MovieListPage({super.key}); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: BlocBuilder<MovieListBloc, MovieListState>( | |
| builder: (context, state) { | |
| return state.when( | |
| loading: => LoadingWidget(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MovieListPage extends StatelessWidget { | |
| const MovieListPage({super.key}); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: BlocBuilder<MovieListBloc, MovieListState>( | |
| builder: (context, state) { | |
| if (state is MovieListLoading) { | |
| return LoadingWidget(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BlocBuilder<MovieListBloc, MovieListState>( | |
| builder: (context, state) { | |
| if (state is MovieListLoading) { | |
| return LoadingWidget(); | |
| } else if (state is MovieListSuccess) { | |
| return SuccessWidget(); | |
| } else if (state is MovieListError) { | |
| return ErrorWidget(); | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| state.movieList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:bloc/bloc.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| import '../../../../core/core.dart'; | |
| import '../../../data/data.dart'; | |
| part 'movie_list_bloc.freezed.dart'; | |
| part 'movie_list_event.dart'; | |
| part 'movie_list_state.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| part of 'movie_list_bloc.dart'; | |
| @freezed | |
| class MovieListEvent with _$MovieListEvent { | |
| const factory MovieListEvent.getNowPlaying() = _GetNowPlaying; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:bloc/bloc.dart'; | |
| import 'package:equatable/equatable.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| import '../../../../core/core.dart'; | |
| import '../../../data/data.dart'; | |
| part 'movie_list_event.dart'; | |
| part 'movie_list_state.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| part of 'movie_list_bloc.dart'; | |
| sealed class MovieListEvent extends Equatable { | |
| const MovieListEvent(); | |
| @override | |
| List<Object?> get props => []; | |
| } | |
| final class GetNowPlaying extends MovieListEvent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:bloc/bloc.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| import '../../../../core/core.dart'; | |
| import '../../../data/data.dart'; | |
| part 'movie_list_bloc.freezed.dart'; | |
| part 'movie_list_event.dart'; | |
| part 'movie_list_state.dart'; |
NewerOlder