Skip to content

Instantly share code, notes, and snippets.

View viveky259259's full-sized avatar
🎯
Focusing on Flutter

Vivek Yadav viveky259259

🎯
Focusing on Flutter
View GitHub Profile
@viveky259259
viveky259259 / note.events.dart
Last active October 16, 2019 11:19
Note Events
class NoteEvent {}
///list of events
/// 1.getNotes 2.add 3.remove 4.remove 5.viewDetailNote
class GetNotesEvent extends NoteEvent {}
class AddNoteEvent extends NoteEvent {}
class RemoveNoteEvent extends NoteEvent {}
@viveky259259
viveky259259 / note.state.dart
Created September 30, 2019 12:20
State Class
class NoteState {}
///list of States
///1.Fetching 2.FetchingComplete 3. EmptyState 4. InitialState
class FetchingNoteState extends NoteState {}
class FetchingNoteCompleteState extends NoteState {}
class EmptyNoteState extends NoteState {}
@viveky259259
viveky259259 / note.bloc.dart
Last active September 30, 2019 12:28
NoteBloc File
import 'package:bloc/bloc.dart';
import 'package:flutter_for_people/bloc/notes/note.event.dart';
import 'package:flutter_for_people/bloc/notes/note.state.dart';
class NoteBloc extends Bloc<NoteEvent, NoteState> {
@override
// TODO: implement initialState
NoteState get initialState => null;
@override
@viveky259259
viveky259259 / note.storage.dart
Last active September 30, 2019 14:47
NoteStorage class
import 'package:flutter_for_people/bloc/notes/note.model.dart';
class NoteStorage {
List<NoteModel> _noteModels = [
NoteModel("Chemistry", "Get book from general store"),
NoteModel("Physics", "Read reference book"),
NoteModel("Maths", "It's really hard bro, if you don't study"),
NoteModel("Football", "Match at 8'o' clock"),
];
@viveky259259
viveky259259 / main.dart
Created September 30, 2019 13:36
Note's main file
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_for_people/bloc/notes/note.bloc.dart';
import 'notes/note.ui.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@viveky259259
viveky259259 / note.ui.dart
Last active September 30, 2019 14:25
NoteUi File
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_for_people/bloc/notes/note.bloc.dart';
import 'package:flutter_for_people/bloc/notes/note.state.dart';
class NotesUi extends StatefulWidget {
@override
_NotesUiState createState() => _NotesUiState();
}
@viveky259259
viveky259259 / note.model.dart
Created September 30, 2019 14:43
Note Model class
class NoteModel {
String _title;
String _description;
NoteModel(this._title, this._description);
String get description => _description;
String get title => _title;
}
@viveky259259
viveky259259 / drawer.dart
Last active October 7, 2019 11:03
Flutter Drawer
import 'package:flutter/material.dart';
class DrawerUi extends StatefulWidget {
@override
_DrawerUiState createState() => _DrawerUiState();
}
class _DrawerUiState extends State<DrawerUi> {
@override
Widget build(BuildContext context) {
@viveky259259
viveky259259 / notes.event.dart
Created October 16, 2019 11:24
BLoC Pattern for flutter Part 3
import 'package:flutter/cupertino.dart';
import 'package:flutter_for_people/bloc/notes/note.model.dart';
class NoteEvent {}
///list of events
/// 1.getNotes 2.add 3.remove 4.remove 5.viewDetailNote
class GetNotesEvent extends NoteEvent {}
@viveky259259
viveky259259 / note.state.dart
Last active October 16, 2019 11:33
BLoC Pattern for flutter -Part 3
import 'package:flutter_for_people/bloc/notes/note.model.dart';
class NoteState {}
///list of States
///1.Fetching 2.FetchingComplete 3. EmptyState 4. InitialState
class FetchingNoteState extends NoteState {}
class FetchingNoteCompleteState extends NoteState {