Skip to content

Instantly share code, notes, and snippets.

View codestronaut's full-sized avatar
🙌
Be Grateful

Aditya Rohman codestronaut

🙌
Be Grateful
View GitHub Profile
# 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
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(),
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();
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();
}
},
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';
part of 'movie_list_bloc.dart';
@freezed
class MovieListEvent with _$MovieListEvent {
const factory MovieListEvent.getNowPlaying() = _GetNowPlaying;
}
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';
part of 'movie_list_bloc.dart';
sealed class MovieListEvent extends Equatable {
const MovieListEvent();
@override
List<Object?> get props => [];
}
final class GetNowPlaying extends MovieListEvent {
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';