mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-21 13:37:29 +01:00
Add Bloc
This commit is contained in:
parent
0b7dd30505
commit
b8130cb6b9
18
lib/bloc/kanji/kanji_bloc.dart
Normal file
18
lib/bloc/kanji/kanji_bloc.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'kanji_event.dart';
|
||||
part 'kanji_state.dart';
|
||||
|
||||
class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
|
||||
KanjiBloc() : super(KanjiSearchInitial());
|
||||
|
||||
@override
|
||||
Stream<KanjiState> mapEventToState(
|
||||
KanjiEvent event,
|
||||
) async* {
|
||||
// TODO: implement mapEventToState
|
||||
}
|
||||
}
|
4
lib/bloc/kanji/kanji_event.dart
Normal file
4
lib/bloc/kanji/kanji_event.dart
Normal file
@ -0,0 +1,4 @@
|
||||
part of 'kanji_bloc.dart';
|
||||
|
||||
@immutable
|
||||
abstract class KanjiEvent {}
|
14
lib/bloc/kanji/kanji_state.dart
Normal file
14
lib/bloc/kanji/kanji_state.dart
Normal file
@ -0,0 +1,14 @@
|
||||
part of 'kanji_bloc.dart';
|
||||
|
||||
@immutable
|
||||
abstract class KanjiState {}
|
||||
|
||||
class KanjiSearchInitial extends KanjiState {}
|
||||
|
||||
class KanjiSearchLoading extends KanjiState {}
|
||||
|
||||
class KanjiSearchFinished extends KanjiState {}
|
||||
|
||||
class KanjiSearchError extends KanjiState {}
|
||||
|
||||
class ReKanjiSearch extends KanjiState {}
|
18
lib/bloc/search/search_bloc.dart
Normal file
18
lib/bloc/search/search_bloc.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'search_event.dart';
|
||||
part 'search_state.dart';
|
||||
|
||||
class SearchBloc extends Bloc<SearchEvent, SearchState> {
|
||||
SearchBloc() : super(SearchInitial());
|
||||
|
||||
@override
|
||||
Stream<SearchState> mapEventToState(
|
||||
SearchEvent event,
|
||||
) async* {
|
||||
// TODO: implement mapEventToState
|
||||
}
|
||||
}
|
4
lib/bloc/search/search_event.dart
Normal file
4
lib/bloc/search/search_event.dart
Normal file
@ -0,0 +1,4 @@
|
||||
part of 'search_bloc.dart';
|
||||
|
||||
@immutable
|
||||
abstract class SearchEvent {}
|
14
lib/bloc/search/search_state.dart
Normal file
14
lib/bloc/search/search_state.dart
Normal file
@ -0,0 +1,14 @@
|
||||
part of 'search_bloc.dart';
|
||||
|
||||
@immutable
|
||||
abstract class SearchState {}
|
||||
|
||||
class SearchInitial extends SearchState {}
|
||||
|
||||
class SearchLoading extends SearchState {}
|
||||
|
||||
class SearchFinished extends SearchState {}
|
||||
|
||||
class SearchError extends SearchState {}
|
||||
|
||||
class ReSearch extends SearchState {}
|
@ -8,7 +8,7 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
title: 'Jisho Study Tool',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
||||
|
||||
import 'package:jisho_study_tool/components/kanjiSearch/kanji_search_card.dart';
|
||||
import 'package:jisho_study_tool/components/kanji/kanji_search_card.dart';
|
||||
|
||||
Widget searchForKanji(String kanji) {
|
||||
return FutureBuilder(
|
||||
|
44
pubspec.lock
44
pubspec.lock
@ -8,6 +8,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
bloc:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bloc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -50,13 +57,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
cubit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cupertino_icons
|
||||
name: cubit
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -69,6 +76,20 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_bloc:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_bloc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
flutter_cubit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_cubit
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -116,6 +137,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.8"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.4"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -130,6 +158,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0+1"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.3.0"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@ -200,3 +235,4 @@ packages:
|
||||
version: "2.0.8"
|
||||
sdks:
|
||||
dart: ">=2.9.0-14.0.dev <3.0.0"
|
||||
flutter: ">=1.16.0"
|
||||
|
@ -22,8 +22,9 @@ dependencies:
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^0.1.2
|
||||
# cupertino_icons: ^0.1.2
|
||||
unofficial_jisho_api: ^1.1.0
|
||||
flutter_bloc: ^5.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
Reference in New Issue
Block a user