mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-21 13:37:29 +01:00
Move all navigation from bloc to Navigator
This commit is contained in:
parent
feee76c2b6
commit
9d8c7b8ebb
@ -1,20 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
part 'history_event.dart';
|
|
||||||
part 'history_state.dart';
|
|
||||||
|
|
||||||
class HistoryBloc extends Bloc<HistoryEvent, HistoryState> {
|
|
||||||
HistoryBloc() : super(HistoryInitial());
|
|
||||||
|
|
||||||
@override
|
|
||||||
Stream<HistoryState> mapEventToState(
|
|
||||||
HistoryEvent event,
|
|
||||||
) async* {
|
|
||||||
// TODO: implement mapEventToState
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
part of 'history_bloc.dart';
|
|
||||||
|
|
||||||
@immutable
|
|
||||||
abstract class HistoryEvent {}
|
|
@ -1,6 +0,0 @@
|
|||||||
part of 'history_bloc.dart';
|
|
||||||
|
|
||||||
@immutable
|
|
||||||
abstract class HistoryState {}
|
|
||||||
|
|
||||||
class HistoryInitial extends HistoryState {}
|
|
@ -1,59 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/models/history/kanji_query.dart';
|
|
||||||
import 'package:jisho_study_tool/models/history/search.dart';
|
|
||||||
|
|
||||||
import './kanji_event.dart';
|
|
||||||
import './kanji_state.dart';
|
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/services/jisho_api/kanji_search.dart';
|
|
||||||
import 'package:jisho_study_tool/services/kanji_suggestions.dart';
|
|
||||||
|
|
||||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
export './kanji_event.dart';
|
|
||||||
export './kanji_state.dart';
|
|
||||||
|
|
||||||
class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
|
|
||||||
DatabaseBloc _databaseBloc;
|
|
||||||
|
|
||||||
KanjiBloc(this._databaseBloc) : super(KanjiSearch(KanjiSearchType.Initial));
|
|
||||||
|
|
||||||
void addSearchToDB(kanji) {
|
|
||||||
if (_databaseBloc.state is DatabaseDisconnected)
|
|
||||||
throw DatabaseNotConnectedException;
|
|
||||||
|
|
||||||
(_databaseBloc.state as DatabaseConnected)
|
|
||||||
.database
|
|
||||||
.box<Search>()
|
|
||||||
.put(Search(timestamp: DateTime.now())
|
|
||||||
..kanjiQuery.target = KanjiQuery(
|
|
||||||
kanji: kanji,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Stream<KanjiState> mapEventToState(KanjiEvent event) async* {
|
|
||||||
if (event is GetKanji) {
|
|
||||||
yield KanjiSearchLoading();
|
|
||||||
|
|
||||||
try {
|
|
||||||
addSearchToDB(event.kanjiSearchString);
|
|
||||||
final kanji = await fetchKanji(event.kanjiSearchString);
|
|
||||||
if (kanji.found)
|
|
||||||
yield KanjiSearchFinished(kanji: kanji);
|
|
||||||
else
|
|
||||||
yield KanjiSearchError('Something went wrong');
|
|
||||||
} on Exception {
|
|
||||||
yield KanjiSearchError('Something went wrong');
|
|
||||||
}
|
|
||||||
} else if (event is GetKanjiSuggestions) {
|
|
||||||
final suggestions = kanjiSuggestions(event.searchString);
|
|
||||||
yield KanjiSearchKeyboard(KanjiSearchType.Keyboard, suggestions);
|
|
||||||
} else if (event is ReturnToInitialState) {
|
|
||||||
yield KanjiSearch(KanjiSearchType.Initial);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
abstract class KanjiEvent {
|
|
||||||
const KanjiEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetKanjiSuggestions extends KanjiEvent {
|
|
||||||
final String searchString;
|
|
||||||
const GetKanjiSuggestions(this.searchString);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetKanji extends KanjiEvent {
|
|
||||||
final String kanjiSearchString;
|
|
||||||
const GetKanji(this.kanjiSearchString);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReturnToInitialState extends KanjiEvent {
|
|
||||||
const ReturnToInitialState();
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:unofficial_jisho_api/api.dart';
|
|
||||||
|
|
||||||
abstract class KanjiState {
|
|
||||||
const KanjiState();
|
|
||||||
}
|
|
||||||
|
|
||||||
enum KanjiSearchType {
|
|
||||||
Initial,
|
|
||||||
Keyboard,
|
|
||||||
Drawing,
|
|
||||||
Radical,
|
|
||||||
Grade
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiSearch extends KanjiState {
|
|
||||||
final KanjiSearchType type;
|
|
||||||
const KanjiSearch(this.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiSearchKeyboard extends KanjiSearch {
|
|
||||||
final List<String> kanjiSuggestions;
|
|
||||||
const KanjiSearchKeyboard(KanjiSearchType type, this.kanjiSuggestions) : super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiSearchLoading extends KanjiState {
|
|
||||||
const KanjiSearchLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiSearchFinished extends KanjiState {
|
|
||||||
final KanjiResult kanji;
|
|
||||||
final bool starred;
|
|
||||||
|
|
||||||
const KanjiSearchFinished({
|
|
||||||
required this.kanji,
|
|
||||||
this.starred = false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiSearchError extends KanjiState {
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
const KanjiSearchError(this.message);
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
import 'package:bloc/bloc.dart';
|
|
||||||
|
|
||||||
import './navigation_event.dart';
|
|
||||||
import './navigation_state.dart';
|
|
||||||
|
|
||||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
export './navigation_event.dart';
|
|
||||||
export './navigation_state.dart';
|
|
||||||
|
|
||||||
class NavigationBloc extends Bloc<NavigationEvent, NavigationState> {
|
|
||||||
|
|
||||||
NavigationBloc() : super(NavigationPage(0));
|
|
||||||
|
|
||||||
@override
|
|
||||||
Stream<NavigationState> mapEventToState(NavigationEvent event) async* {
|
|
||||||
if (event is ChangePage)
|
|
||||||
yield NavigationPage(event.pageNum);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
abstract class NavigationEvent {
|
|
||||||
const NavigationEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChangePage extends NavigationEvent {
|
|
||||||
final int pageNum;
|
|
||||||
const ChangePage(this.pageNum);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
abstract class NavigationState {
|
|
||||||
const NavigationState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class NavigationPage extends NavigationState {
|
|
||||||
final int pageNum;
|
|
||||||
const NavigationPage(this.pageNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:jisho_study_tool/models/history/search.dart';
|
|
||||||
import 'package:jisho_study_tool/models/history/word_query.dart';
|
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/services/jisho_api/jisho_search.dart';
|
|
||||||
import 'package:unofficial_jisho_api/parser.dart';
|
|
||||||
|
|
||||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
part 'search_event.dart';
|
|
||||||
part 'search_state.dart';
|
|
||||||
|
|
||||||
class SearchBloc extends Bloc<SearchEvent, SearchState> {
|
|
||||||
DatabaseBloc _databaseBloc;
|
|
||||||
|
|
||||||
SearchBloc(this._databaseBloc) : super(SearchInitial());
|
|
||||||
|
|
||||||
void addSearchToDB(searchString) {
|
|
||||||
if (_databaseBloc.state is DatabaseDisconnected)
|
|
||||||
throw DatabaseNotConnectedException;
|
|
||||||
|
|
||||||
(_databaseBloc.state as DatabaseConnected)
|
|
||||||
.database
|
|
||||||
.box<Search>()
|
|
||||||
.put(Search(timestamp: DateTime.now())
|
|
||||||
..wordQuery.target = WordQuery(
|
|
||||||
query: searchString,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Stream<SearchState> mapEventToState(
|
|
||||||
SearchEvent event,
|
|
||||||
) async* {
|
|
||||||
if (event is GetSearchResults) {
|
|
||||||
yield SearchLoading();
|
|
||||||
|
|
||||||
try {
|
|
||||||
addSearchToDB(event.searchString);
|
|
||||||
final searchResults = await fetchJishoResults(event.searchString);
|
|
||||||
if (searchResults.meta.status == 200)
|
|
||||||
yield SearchFinished(searchResults.data!);
|
|
||||||
} on Exception {
|
|
||||||
yield SearchError('Something went wrong');
|
|
||||||
}
|
|
||||||
} else if (event is ReturnToInitialState) {
|
|
||||||
yield SearchInitial();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
part of 'search_bloc.dart';
|
|
||||||
|
|
||||||
@immutable
|
|
||||||
abstract class SearchEvent {
|
|
||||||
const SearchEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetSearchResults extends SearchEvent {
|
|
||||||
final String searchString;
|
|
||||||
const GetSearchResults(this.searchString);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReturnToInitialState extends SearchEvent {
|
|
||||||
const ReturnToInitialState();
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
part of 'search_bloc.dart';
|
|
||||||
|
|
||||||
@immutable
|
|
||||||
abstract class SearchState {
|
|
||||||
const SearchState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchInitial extends SearchState {
|
|
||||||
const SearchInitial();
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchLoading extends SearchState {
|
|
||||||
const SearchLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchFinished extends SearchState {
|
|
||||||
final List<JishoResult> results;
|
|
||||||
|
|
||||||
const SearchFinished(this.results);
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchError extends SearchState {
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
const SearchError(this.message);
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
||||||
import 'package:jisho_study_tool/view/screens/splash.dart';
|
import 'package:jisho_study_tool/router.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/common/splash.dart';
|
||||||
import 'package:mdi/mdi.dart';
|
import 'package:mdi/mdi.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
@ -8,13 +9,10 @@ import 'package:path/path.dart';
|
|||||||
import 'package:jisho_study_tool/objectbox.g.dart';
|
import 'package:jisho_study_tool/objectbox.g.dart';
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/navigation/navigation_bloc.dart';
|
|
||||||
|
|
||||||
import 'package:jisho_study_tool/view/screens/kanji/view.dart';
|
import 'package:jisho_study_tool/view/screens/search/kanji_view.dart';
|
||||||
import 'package:jisho_study_tool/view/screens/history.dart';
|
import 'package:jisho_study_tool/view/screens/history.dart';
|
||||||
import 'package:jisho_study_tool/view/screens/search/view.dart';
|
import 'package:jisho_study_tool/view/screens/search/search_view.dart';
|
||||||
import 'package:jisho_study_tool/view/screens/settings.dart';
|
import 'package:jisho_study_tool/view/screens/settings.dart';
|
||||||
|
|
||||||
import 'models/themes/theme.dart';
|
import 'models/themes/theme.dart';
|
||||||
@ -60,20 +58,19 @@ class _MyAppState extends State<MyApp> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider(create: (context) => SearchBloc(_databaseBloc)),
|
|
||||||
BlocProvider(create: (context) => KanjiBloc(_databaseBloc)),
|
|
||||||
BlocProvider(create: (context) => _databaseBloc),
|
BlocProvider(create: (context) => _databaseBloc),
|
||||||
BlocProvider(create: (context) => NavigationBloc()),
|
|
||||||
BlocProvider(create: (context) => ThemeBloc()),
|
BlocProvider(create: (context) => ThemeBloc()),
|
||||||
],
|
],
|
||||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||||
builder: (context, themeState) {
|
builder: (context, themeState) {
|
||||||
|
if (!(dbConnected && themeState.prefsAreLoaded))
|
||||||
|
return SplashScreen();
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Jisho Study Tool',
|
title: 'Jisho Study Tool',
|
||||||
theme: themeState.theme.getMaterialTheme(),
|
theme: themeState.theme.getMaterialTheme(),
|
||||||
home: dbConnected && themeState.prefsAreLoaded
|
initialRoute: '/',
|
||||||
? Home()
|
onGenerateRoute: PageRouter.generateRoute,
|
||||||
: SplashScreen(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -81,45 +78,48 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Home extends StatelessWidget {
|
class Home extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _HomeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeState extends State<Home> {
|
||||||
|
int pageNum = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NavigationBloc, NavigationState>(
|
return BlocBuilder<ThemeBloc, ThemeState>(
|
||||||
builder: (context, navigationState) {
|
builder: (context, themeState) {
|
||||||
int selectedPage = (navigationState as NavigationPage).pageNum;
|
return Scaffold(
|
||||||
return BlocBuilder<ThemeBloc, ThemeState>(
|
appBar: AppBar(
|
||||||
builder: (context, themeState) {
|
title: pages[pageNum].titleBar,
|
||||||
return Scaffold(
|
centerTitle: true,
|
||||||
appBar: AppBar(
|
backgroundColor: AppTheme.jishoGreen.background,
|
||||||
title: pages[selectedPage].titleBar,
|
foregroundColor: AppTheme.jishoGreen.foreground,
|
||||||
centerTitle: true,
|
),
|
||||||
backgroundColor: AppTheme.jishoGreen.background,
|
body: Stack(
|
||||||
foregroundColor: AppTheme.jishoGreen.foreground,
|
children: [
|
||||||
|
Positioned(
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/denshi_jisho_background_overlay.png'),
|
||||||
|
right: 30,
|
||||||
|
left: 100,
|
||||||
|
bottom: 30,
|
||||||
),
|
),
|
||||||
body: Stack(
|
pages[pageNum].content,
|
||||||
children: [
|
],
|
||||||
Positioned(
|
),
|
||||||
child: Image.asset(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
'assets/images/denshi_jisho_background_overlay.png'),
|
fixedColor: AppTheme.jishoGreen.background,
|
||||||
right: 30,
|
currentIndex: pageNum,
|
||||||
left: 100,
|
onTap: (int index) => setState(() {
|
||||||
bottom: 30,
|
this.pageNum = index;
|
||||||
),
|
}),
|
||||||
pages[selectedPage].content,
|
items: pages.map((p) => p.item).toList(),
|
||||||
],
|
showSelectedLabels: false,
|
||||||
),
|
showUnselectedLabels: false,
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
unselectedItemColor: themeState.theme.menuGreyDark.background,
|
||||||
fixedColor: AppTheme.jishoGreen.background,
|
),
|
||||||
currentIndex: selectedPage,
|
|
||||||
onTap: (int index) => BlocProvider.of<NavigationBloc>(context)
|
|
||||||
.add(ChangePage(index)),
|
|
||||||
items: pages.map((p) => p.item).toList(),
|
|
||||||
showSelectedLabels: false,
|
|
||||||
showUnselectedLabels: false,
|
|
||||||
unselectedItemColor: themeState.theme.menuGreyDark.background,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -149,7 +149,7 @@ final List<_Page> pages = [
|
|||||||
),
|
),
|
||||||
_Page(
|
_Page(
|
||||||
content: KanjiView(),
|
content: KanjiView(),
|
||||||
titleBar: KanjiViewBar(),
|
titleBar: Text('Kanji'),
|
||||||
item: BottomNavigationBarItem(
|
item: BottomNavigationBarItem(
|
||||||
label: 'Kanji', icon: Icon(Mdi.ideogramCjk, size: 30)),
|
label: 'Kanji', icon: Icon(Mdi.ideogramCjk, size: 30)),
|
||||||
),
|
),
|
||||||
|
27
lib/router.dart
Normal file
27
lib/router.dart
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jisho_study_tool/view/screens/search/kanji_result_page.dart';
|
||||||
|
import 'package:jisho_study_tool/view/screens/search/search_results_page.dart';
|
||||||
|
|
||||||
|
import 'main.dart';
|
||||||
|
|
||||||
|
class PageRouter {
|
||||||
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
|
final args = settings.arguments;
|
||||||
|
|
||||||
|
switch (settings.name) {
|
||||||
|
case '/':
|
||||||
|
return MaterialPageRoute(builder: (_) => Home());
|
||||||
|
|
||||||
|
case '/search':
|
||||||
|
final searchTerm = args as String;
|
||||||
|
return MaterialPageRoute(builder: (_) => SearchResultsPage(searchTerm: searchTerm));
|
||||||
|
|
||||||
|
case '/kanjiSearch':
|
||||||
|
final searchTerm = args as String;
|
||||||
|
return MaterialPageRoute(builder: (_) => KanjiResultPage(kanjiSearchTerm: searchTerm));
|
||||||
|
|
||||||
|
default:
|
||||||
|
return MaterialPageRoute(builder: (_) => Text("ERROR: this route does not exist"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
||||||
|
export 'package:unofficial_jisho_api/api.dart' show JishoAPIResult;
|
||||||
|
|
||||||
Future<jisho.JishoAPIResult> fetchJishoResults(searchTerm) async {
|
Future<jisho.JishoAPIResult> fetchJishoResults(searchTerm) async {
|
||||||
return await jisho.searchForPhrase(searchTerm);
|
return await jisho.searchForPhrase(searchTerm);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
||||||
|
export 'package:unofficial_jisho_api/api.dart' show KanjiResult;
|
||||||
|
|
||||||
String? _convertGrade(String grade) {
|
String? _convertGrade(String grade) {
|
||||||
const conversionTable = {
|
const conversionTable = {
|
||||||
|
@ -9,7 +9,7 @@ class SplashScreen extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(color: AppTheme.jishoGreen.background),
|
decoration: BoxDecoration(color: AppTheme.jishoGreen.background),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Image.asset('assets/images/logo/logo_icon_transparent.png'),
|
child: Image(image: AssetImage('assets/images/logo/logo_icon_transparent.png'),)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/navigation/navigation_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
||||||
import 'package:jisho_study_tool/models/history/kanji_query.dart';
|
import 'package:jisho_study_tool/models/history/kanji_query.dart';
|
||||||
import 'package:jisho_study_tool/models/themes/theme.dart';
|
import 'package:jisho_study_tool/models/themes/theme.dart';
|
||||||
@ -58,8 +56,7 @@ class KanjiSearchItem extends StatelessWidget {
|
|||||||
return Slidable(
|
return Slidable(
|
||||||
child: SearchItem(
|
child: SearchItem(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
BlocProvider.of<NavigationBloc>(context).add(ChangePage(1));
|
Navigator.pushNamed(context, '/kanjiSearch', arguments: this.result.kanji);
|
||||||
BlocProvider.of<KanjiBloc>(context).add(GetKanji(this.result.kanji));
|
|
||||||
},
|
},
|
||||||
time: timestamp,
|
time: timestamp,
|
||||||
search: _KanjiBox(result.kanji),
|
search: _KanjiBox(result.kanji),
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:jisho_study_tool/bloc/navigation/navigation_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/models/history/word_query.dart';
|
import 'package:jisho_study_tool/models/history/word_query.dart';
|
||||||
|
|
||||||
import './search_item.dart';
|
import './search_item.dart';
|
||||||
@ -26,8 +24,7 @@ class PhraseSearchItem extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
child: SearchItem(
|
child: SearchItem(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
BlocProvider.of<NavigationBloc>(context).add(ChangePage(0));
|
Navigator.pushNamed(context, '/search', arguments: this.search.query);
|
||||||
BlocProvider.of<SearchBloc>(context).add(GetSearchResults(this.search.query));
|
|
||||||
},
|
},
|
||||||
time: timestamp,
|
time: timestamp,
|
||||||
search: Text(search.query),
|
search: Text(search.query),
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
||||||
|
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/examples.dart';
|
import './kanji_result_body/examples.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/grade.dart';
|
import './kanji_result_body/grade.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/header.dart';
|
import './kanji_result_body/header.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/jlpt_level.dart';
|
import './kanji_result_body/jlpt_level.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/radical.dart';
|
import './kanji_result_body/radical.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/rank.dart';
|
import './kanji_result_body/rank.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/stroke_order_gif.dart';
|
import './kanji_result_body/stroke_order_gif.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/result/yomi_chips.dart';
|
import './kanji_result_body/yomi_chips.dart';
|
||||||
|
|
||||||
class KanjiResultCard extends StatelessWidget {
|
class KanjiResultBody extends StatelessWidget {
|
||||||
late final String query;
|
late final String query;
|
||||||
late final jisho.KanjiResultData resultData;
|
late final jisho.KanjiResultData resultData;
|
||||||
|
|
||||||
KanjiResultCard({required jisho.KanjiResult result}) {
|
KanjiResultBody({required jisho.KanjiResult result}) {
|
||||||
|
|
||||||
query = result.query;
|
query = result.query;
|
||||||
|
|
107
lib/view/components/kanji/kanji_search_body.dart
Normal file
107
lib/view/components/kanji/kanji_search_body.dart
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:animated_size_and_fade/animated_size_and_fade.dart';
|
||||||
|
import 'package:jisho_study_tool/services/kanji_suggestions.dart';
|
||||||
|
|
||||||
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body/kanji_grid.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body/kanji_search_bar.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body/kanji_search_options_bar.dart';
|
||||||
|
|
||||||
|
class KanjiSearchBody extends StatefulWidget {
|
||||||
|
KanjiSearchBody({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_KanjiSearchBodyState createState() => _KanjiSearchBodyState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _KanjiSearchBodyState extends State<KanjiSearchBody>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late final AnimationController _controller;
|
||||||
|
late final Animation _searchbarMovementAnimation;
|
||||||
|
final FocusNode focus = FocusNode();
|
||||||
|
final GlobalKey<KanjiSearchBarState> _kanjiSearchBarState =
|
||||||
|
GlobalKey<KanjiSearchBarState>();
|
||||||
|
List<String> suggestions = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_controller = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: Duration(milliseconds: 200),
|
||||||
|
);
|
||||||
|
|
||||||
|
_searchbarMovementAnimation = AlignmentTween(
|
||||||
|
begin: Alignment.center,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
).animate(CurvedAnimation(
|
||||||
|
parent: _controller,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
if (_controller.value == 1) {
|
||||||
|
focus.unfocus();
|
||||||
|
_kanjiSearchBarState.currentState!.clearText();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: AnimatedBuilder(
|
||||||
|
animation: _searchbarMovementAnimation,
|
||||||
|
builder: (BuildContext context, _) {
|
||||||
|
return Container(
|
||||||
|
alignment: _searchbarMovementAnimation.value,
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Focus(
|
||||||
|
focusNode: focus,
|
||||||
|
onFocusChange: (hasFocus) {
|
||||||
|
if (hasFocus)
|
||||||
|
_controller.forward();
|
||||||
|
else
|
||||||
|
_controller.reverse();
|
||||||
|
},
|
||||||
|
child: KanjiSearchBar(
|
||||||
|
key: _kanjiSearchBarState,
|
||||||
|
onChanged: (text) => setState(() {
|
||||||
|
this.suggestions = kanjiSuggestions(text);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
AnimatedSizeAndFade(
|
||||||
|
vsync: this,
|
||||||
|
child: _controller.value == 1
|
||||||
|
? KanjiGrid(this.suggestions)
|
||||||
|
: KanjiSearchOptionsBar(),
|
||||||
|
fadeDuration: const Duration(milliseconds: 200),
|
||||||
|
sizeDuration: const Duration(milliseconds: 300),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
import 'package:jisho_study_tool/bloc/theme/theme_bloc.dart';
|
||||||
|
|
||||||
class KanjiGrid extends StatelessWidget {
|
class KanjiGrid extends StatelessWidget {
|
||||||
@ -33,29 +32,28 @@ class _GridItem extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
BlocProvider.of<KanjiBloc>(context).add(GetKanji(kanji));
|
Navigator.pushNamed(context, '/kanjiSearch', arguments: kanji);
|
||||||
},
|
},
|
||||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final _menuColors = state.theme.menuGreyLight;
|
final _menuColors = state.theme.menuGreyLight;
|
||||||
return
|
return Container(
|
||||||
Container(
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
color: _menuColors.background,
|
||||||
color: _menuColors.background,
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.all(10.0),
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(
|
|
||||||
kanji,
|
|
||||||
style: TextStyle(color: _menuColors.foreground),
|
|
||||||
),
|
),
|
||||||
),
|
child: Container(
|
||||||
),
|
margin: EdgeInsets.all(10.0),
|
||||||
);
|
child: FittedBox(
|
||||||
|
child: Text(
|
||||||
|
kanji,
|
||||||
|
style: TextStyle(color: _menuColors.foreground),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,41 +1,43 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
|
|
||||||
class KanjiSearchBar extends StatefulWidget {
|
class KanjiSearchBar extends StatefulWidget {
|
||||||
|
final Function(String)? onChanged;
|
||||||
|
|
||||||
const KanjiSearchBar();
|
KanjiSearchBar({this.onChanged, Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_KanjiSearchBarState createState() => new _KanjiSearchBarState();
|
KanjiSearchBarState createState() => new KanjiSearchBarState(this.onChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TextFieldButton {clear, paste}
|
enum TextFieldButton { clear, paste }
|
||||||
|
|
||||||
class _KanjiSearchBarState extends State<KanjiSearchBar> {
|
class KanjiSearchBarState extends State<KanjiSearchBar> {
|
||||||
final TextEditingController textController = new TextEditingController();
|
final TextEditingController textController = new TextEditingController();
|
||||||
TextFieldButton button = TextFieldButton.paste;
|
TextFieldButton button = TextFieldButton.paste;
|
||||||
|
final Function(String)? onChanged;
|
||||||
|
|
||||||
|
KanjiSearchBarState(this.onChanged);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _getKanjiSuggestions(String text) =>
|
void runOnChanged() {
|
||||||
BlocProvider.of<KanjiBloc>(context).add(GetKanjiSuggestions(text));
|
if (onChanged != null) onChanged!(textController.text);
|
||||||
|
|
||||||
void updateSuggestions() => _getKanjiSuggestions(textController.text);
|
|
||||||
|
|
||||||
void _clearText() {
|
|
||||||
textController.text = '';
|
|
||||||
updateSuggestions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _pasteText() async {
|
void clearText() {
|
||||||
|
textController.text = '';
|
||||||
|
runOnChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pasteText() async {
|
||||||
ClipboardData? clipboardData = await Clipboard.getData('text/plain');
|
ClipboardData? clipboardData = await Clipboard.getData('text/plain');
|
||||||
if (clipboardData != null && clipboardData.text != null) {
|
if (clipboardData != null && clipboardData.text != null) {
|
||||||
textController.text = clipboardData.text!;
|
textController.text = clipboardData.text!;
|
||||||
updateSuggestions();
|
runOnChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,29 +45,32 @@ class _KanjiSearchBarState extends State<KanjiSearchBar> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
IconButton clearButton = IconButton(
|
IconButton clearButton = IconButton(
|
||||||
icon: Icon(Icons.clear),
|
icon: Icon(Icons.clear),
|
||||||
onPressed: () => _clearText(),
|
onPressed: () => clearText(),
|
||||||
);
|
);
|
||||||
|
|
||||||
IconButton pasteButton = IconButton(
|
IconButton pasteButton = IconButton(
|
||||||
icon: Icon(Icons.content_paste),
|
icon: Icon(Icons.content_paste),
|
||||||
onPressed: () => _pasteText(),
|
onPressed: () => pasteText(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return TextField(
|
return TextField(
|
||||||
controller: textController,
|
controller: textController,
|
||||||
onChanged: (text) => _getKanjiSuggestions(text),
|
onChanged: (text) {
|
||||||
|
if (this.onChanged != null) this.onChanged!(text);
|
||||||
|
},
|
||||||
onSubmitted: (_) => {},
|
onSubmitted: (_) => {},
|
||||||
decoration: new InputDecoration(
|
decoration: new InputDecoration(
|
||||||
prefixIcon: Icon(Icons.search),
|
prefixIcon: Icon(Icons.search),
|
||||||
hintText: 'Search',
|
hintText: 'Search',
|
||||||
// fillColor: Colors.white,
|
// fillColor: Colors.white,
|
||||||
// filled: true,
|
// filled: true,
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
),
|
),
|
||||||
isDense: false,
|
isDense: false,
|
||||||
suffixIcon: (button == TextFieldButton.clear) ? clearButton : pasteButton,
|
suffixIcon:
|
||||||
|
(button == TextFieldButton.clear) ? clearButton : pasteButton,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
|
|
||||||
//TODO: Make buttons have an effect
|
//TODO: Make buttons have an effect
|
||||||
|
|
||||||
@ -20,18 +19,15 @@ class KanjiSearchOptionsBar extends StatelessWidget {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () =>
|
onPressed: () {}
|
||||||
BlocProvider.of<KanjiBloc>(context).add(ReturnToInitialState()),
|
|
||||||
),
|
),
|
||||||
_IconButton(
|
_IconButton(
|
||||||
icon: Icon(Icons.category),
|
icon: Icon(Icons.category),
|
||||||
onPressed: () =>
|
onPressed: () {}
|
||||||
BlocProvider.of<KanjiBloc>(context).add(ReturnToInitialState()),
|
|
||||||
),
|
),
|
||||||
_IconButton(
|
_IconButton(
|
||||||
icon: Icon(Icons.mode),
|
icon: Icon(Icons.mode),
|
||||||
onPressed: () =>
|
onPressed: () {}
|
||||||
BlocProvider.of<KanjiBloc>(context).add(ReturnToInitialState()),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/search/language_selector.dart';
|
import 'package:jisho_study_tool/view/components/search/language_selector.dart';
|
||||||
|
|
||||||
class SearchBar extends StatelessWidget {
|
class SearchBar extends StatelessWidget {
|
||||||
|
|
||||||
const SearchBar();
|
const SearchBar();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -13,10 +11,8 @@ class SearchBar extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
onSubmitted: (text) {
|
onSubmitted: (text) =>
|
||||||
BlocProvider.of<SearchBloc>(context)
|
Navigator.pushNamed(context, '/search', arguments: text),
|
||||||
.add(GetSearchResults(text));
|
|
||||||
},
|
|
||||||
controller: TextEditingController(),
|
controller: TextEditingController(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Search',
|
labelText: 'Search',
|
||||||
@ -33,4 +29,4 @@ class SearchBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
lib/view/components/search/search_result_body.dart
Normal file
19
lib/view/components/search/search_result_body.dart
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/search/search_results_body/search_card.dart';
|
||||||
|
import 'package:unofficial_jisho_api/api.dart';
|
||||||
|
|
||||||
|
class SearchResultsBody extends StatelessWidget {
|
||||||
|
final List<JishoResult> results;
|
||||||
|
|
||||||
|
const SearchResultsBody({
|
||||||
|
required this.results,
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView(
|
||||||
|
children: results.map((result) => SearchResultCard(result)).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/badge.dart';
|
import './badge.dart';
|
||||||
|
|
||||||
class CommonBadge extends StatelessWidget {
|
class CommonBadge extends StatelessWidget {
|
||||||
final bool isCommon;
|
final bool isCommon;
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/badge.dart';
|
import './badge.dart';
|
||||||
|
|
||||||
class JLPTBadge extends StatelessWidget {
|
class JLPTBadge extends StatelessWidget {
|
||||||
final String jlptLevel;
|
final String jlptLevel;
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/badge.dart';
|
import './badge.dart';
|
||||||
|
|
||||||
class WKBadge extends StatelessWidget {
|
class WKBadge extends StatelessWidget {
|
||||||
final String wkLevel;
|
final String wkLevel;
|
@ -1,13 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/common_badge.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/jlpt_badge.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/parts/wanikani_badge.dart';
|
|
||||||
|
|
||||||
import 'package:unofficial_jisho_api/api.dart';
|
import 'package:unofficial_jisho_api/api.dart';
|
||||||
|
|
||||||
|
import './parts/common_badge.dart';
|
||||||
import './parts/header.dart';
|
import './parts/header.dart';
|
||||||
import './parts/senses.dart';
|
import './parts/jlpt_badge.dart';
|
||||||
import './parts/other_forms.dart';
|
import './parts/other_forms.dart';
|
||||||
|
import './parts/senses.dart';
|
||||||
|
import './parts/wanikani_badge.dart';
|
||||||
|
|
||||||
class SearchResultCard extends StatelessWidget {
|
class SearchResultCard extends StatelessWidget {
|
||||||
final JishoResult result;
|
final JishoResult result;
|
@ -1,94 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
import 'package:animated_size_and_fade/animated_size_and_fade.dart';
|
|
||||||
|
|
||||||
import 'package:jisho_study_tool/view/components/kanji/kanji_grid.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/kanji/kanji_search_bar.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/kanji/kanji_search_options_bar.dart';
|
|
||||||
|
|
||||||
class SearchScreen extends StatefulWidget {
|
|
||||||
SearchScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_SearchScreenState createState() => _SearchScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SearchScreenState extends State<SearchScreen>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late final AnimationController _controller;
|
|
||||||
late final Animation _searchbarMovementAnimation;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_controller = AnimationController(
|
|
||||||
vsync: this,
|
|
||||||
duration: Duration(milliseconds: 200),
|
|
||||||
);
|
|
||||||
|
|
||||||
_searchbarMovementAnimation = AlignmentTween(
|
|
||||||
begin: Alignment.center,
|
|
||||||
end: Alignment.topCenter,
|
|
||||||
).animate(CurvedAnimation(
|
|
||||||
parent: _controller,
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_controller.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
||||||
child: AnimatedBuilder(
|
|
||||||
animation: _searchbarMovementAnimation,
|
|
||||||
builder: (BuildContext context, _) {
|
|
||||||
return Container(
|
|
||||||
alignment: _searchbarMovementAnimation.value,
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Focus(
|
|
||||||
onFocusChange: (hasFocus) {
|
|
||||||
if (hasFocus)
|
|
||||||
_controller.forward();
|
|
||||||
else
|
|
||||||
_controller.reverse();
|
|
||||||
},
|
|
||||||
child: KanjiSearchBar(),
|
|
||||||
),
|
|
||||||
BlocBuilder<KanjiBloc, KanjiState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return AnimatedSizeAndFade(
|
|
||||||
vsync: this,
|
|
||||||
child: _controller.value == 1
|
|
||||||
? KanjiGrid((state is KanjiSearchKeyboard)
|
|
||||||
? state.kanjiSuggestions
|
|
||||||
: [])
|
|
||||||
// ? Container()
|
|
||||||
: KanjiSearchOptionsBar(),
|
|
||||||
fadeDuration: const Duration(milliseconds: 200),
|
|
||||||
sizeDuration: const Duration(milliseconds: 300),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/view/screens/loading.dart';
|
|
||||||
|
|
||||||
import 'search.dart';
|
|
||||||
import 'result.dart';
|
|
||||||
|
|
||||||
class KanjiView extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BlocListener<KanjiBloc, KanjiState>(
|
|
||||||
listener: (context, state) {
|
|
||||||
if (state is KanjiSearch && state.type == KanjiSearchType.Initial) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
} else if (state is KanjiSearchLoading) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: BlocBuilder<KanjiBloc, KanjiState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is KanjiSearch) {
|
|
||||||
if (state.type == KanjiSearchType.Initial) return SearchScreen();
|
|
||||||
else if (state is KanjiSearchKeyboard) return SearchScreen();
|
|
||||||
}
|
|
||||||
else if (state is KanjiSearchLoading) return LoadingScreen();
|
|
||||||
else if (state is KanjiSearchFinished)
|
|
||||||
return WillPopScope(
|
|
||||||
child: KanjiResultCard(result: state.kanji),
|
|
||||||
onWillPop: () async {
|
|
||||||
BlocProvider.of<KanjiBloc>(context)
|
|
||||||
.add(ReturnToInitialState());
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
throw 'No such event found';
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KanjiViewBar extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.arrow_back),
|
|
||||||
onPressed: () =>
|
|
||||||
BlocProvider.of<KanjiBloc>(context).add(ReturnToInitialState()),
|
|
||||||
),
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// child: KanjiSearchBar(),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// IconButton(
|
|
||||||
// icon: Icon(Icons.star_border),
|
|
||||||
// onPressed: null,
|
|
||||||
// ),
|
|
||||||
// IconButton(
|
|
||||||
// icon: Icon(Icons.add),
|
|
||||||
// onPressed: null,
|
|
||||||
// ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
42
lib/view/screens/search/kanji_result_page.dart
Normal file
42
lib/view/screens/search/kanji_result_page.dart
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
||||||
|
import 'package:jisho_study_tool/models/history/kanji_query.dart';
|
||||||
|
import 'package:jisho_study_tool/models/history/search.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/common/loading.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/kanji/kanji_result_body.dart';
|
||||||
|
import 'package:jisho_study_tool/services/jisho_api/kanji_search.dart';
|
||||||
|
|
||||||
|
class KanjiResultPage extends StatelessWidget {
|
||||||
|
final String kanjiSearchTerm;
|
||||||
|
bool addedToDatabase = false;
|
||||||
|
|
||||||
|
KanjiResultPage({required this.kanjiSearchTerm, Key? key})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(),
|
||||||
|
body: FutureBuilder(
|
||||||
|
future: fetchKanji(this.kanjiSearchTerm),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) return LoadingScreen();
|
||||||
|
if (snapshot.hasError) return ErrorWidget(snapshot.error!);
|
||||||
|
|
||||||
|
if (!this.addedToDatabase) {
|
||||||
|
(BlocProvider.of<DatabaseBloc>(context).state as DatabaseConnected)
|
||||||
|
.database
|
||||||
|
.box<Search>()
|
||||||
|
.put(Search(timestamp: DateTime.now())
|
||||||
|
..kanjiQuery.target = KanjiQuery(
|
||||||
|
kanji: this.kanjiSearchTerm,
|
||||||
|
));
|
||||||
|
this.addedToDatabase = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return KanjiResultBody(result: (snapshot.data as KanjiResult));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
11
lib/view/screens/search/kanji_view.dart
Normal file
11
lib/view/screens/search/kanji_view.dart
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body.dart';
|
||||||
|
|
||||||
|
class KanjiView extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return KanjiSearchBody();
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/search/search_result_page/search_card.dart';
|
|
||||||
import 'package:unofficial_jisho_api/api.dart';
|
|
||||||
|
|
||||||
class SearchResults extends StatelessWidget {
|
|
||||||
final List<JishoResult> results;
|
|
||||||
|
|
||||||
const SearchResults({
|
|
||||||
required this.results,
|
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return WillPopScope(
|
|
||||||
child: ListView(
|
|
||||||
children: results.map((result) => SearchResultCard(result)).toList(),
|
|
||||||
),
|
|
||||||
onWillPop: () async {
|
|
||||||
BlocProvider.of<SearchBloc>(context).add(ReturnToInitialState());
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/kanji_grid.dart';
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body/kanji_grid.dart';
|
||||||
import 'package:jisho_study_tool/view/components/kanji/kanji_search_bar.dart';
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_body/kanji_search_bar.dart';
|
||||||
|
|
||||||
class SearchGrid extends StatelessWidget {
|
class SearchGrid extends StatelessWidget {
|
||||||
final List<String> suggestions;
|
final List<String> suggestions;
|
48
lib/view/screens/search/search_results_page.dart
Normal file
48
lib/view/screens/search/search_results_page.dart
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jisho_study_tool/bloc/database/database_bloc.dart';
|
||||||
|
import 'package:jisho_study_tool/models/history/search.dart';
|
||||||
|
import 'package:jisho_study_tool/models/history/word_query.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/common/loading.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/search/search_result_body.dart';
|
||||||
|
import 'package:jisho_study_tool/services/jisho_api/jisho_search.dart';
|
||||||
|
|
||||||
|
class SearchResultsPage extends StatelessWidget {
|
||||||
|
final String searchTerm;
|
||||||
|
final Future<JishoAPIResult> results;
|
||||||
|
bool addedToDatabase = false;
|
||||||
|
|
||||||
|
SearchResultsPage({required this.searchTerm, Key? key})
|
||||||
|
: this.results = fetchJishoResults(searchTerm),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(),
|
||||||
|
body: FutureBuilder(
|
||||||
|
future: results,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) return LoadingScreen();
|
||||||
|
if (snapshot.hasError ||
|
||||||
|
(snapshot.data as JishoAPIResult).data == null)
|
||||||
|
return ErrorWidget(snapshot.error!);
|
||||||
|
|
||||||
|
if (!this.addedToDatabase) {
|
||||||
|
(BlocProvider.of<DatabaseBloc>(context).state as DatabaseConnected)
|
||||||
|
.database
|
||||||
|
.box<Search>()
|
||||||
|
.put(Search(timestamp: DateTime.now())
|
||||||
|
..wordQuery.target = WordQuery(
|
||||||
|
query: this.searchTerm,
|
||||||
|
));
|
||||||
|
this.addedToDatabase = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SearchResultsBody(
|
||||||
|
results: (snapshot.data as JishoAPIResult).data!,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
14
lib/view/screens/search/search_view.dart
Normal file
14
lib/view/screens/search/search_view.dart
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/search/search_bar.dart';
|
||||||
|
|
||||||
|
class SearchView extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SearchBar(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,33 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
|
||||||
import 'package:jisho_study_tool/view/components/search/search_bar.dart';
|
|
||||||
import 'package:jisho_study_tool/view/screens/loading.dart';
|
|
||||||
import 'package:jisho_study_tool/view/screens/search/results.dart';
|
|
||||||
|
|
||||||
class SearchView extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BlocConsumer<SearchBloc, SearchState>(
|
|
||||||
listener: (context, state) {},
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is SearchInitial)
|
|
||||||
return _InitialView();
|
|
||||||
else if (state is SearchLoading)
|
|
||||||
return LoadingScreen();
|
|
||||||
else if (state is SearchFinished) {
|
|
||||||
return SearchResults(results: state.results);
|
|
||||||
}
|
|
||||||
throw 'No such event found';
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _InitialView extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
|
||||||
SearchBar(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
142
pubspec.lock
142
pubspec.lock
@ -15,20 +15,34 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.2"
|
version: "1.7.2"
|
||||||
|
animated_size_and_fade:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: animated_size_and_fade
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
|
archive:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: archive
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.2"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: args
|
name: args
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.2.0"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.0"
|
version: "2.8.2"
|
||||||
bloc:
|
bloc:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -56,14 +70,14 @@ packages:
|
|||||||
name: build_config
|
name: build_config
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.7"
|
version: "1.0.0"
|
||||||
build_daemon:
|
build_daemon:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_daemon
|
name: build_daemon
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.10"
|
version: "3.0.0"
|
||||||
build_resolvers:
|
build_resolvers:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -77,14 +91,14 @@ packages:
|
|||||||
name: build_runner
|
name: build_runner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.12.2"
|
version: "2.0.6"
|
||||||
build_runner_core:
|
build_runner_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_runner_core
|
name: build_runner_core
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.12"
|
version: "7.0.1"
|
||||||
built_collection:
|
built_collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -112,7 +126,7 @@ packages:
|
|||||||
name: charcode
|
name: charcode
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.1"
|
||||||
checked_yaml:
|
checked_yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -140,7 +154,7 @@ packages:
|
|||||||
name: code_builder
|
name: code_builder
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.7.0"
|
version: "4.1.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -148,6 +162,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.15.0"
|
||||||
|
confirm_dialog:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: confirm_dialog
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -168,7 +189,7 @@ packages:
|
|||||||
name: csslib
|
name: csslib
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.2"
|
version: "0.17.0"
|
||||||
dart_style:
|
dart_style:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -182,7 +203,7 @@ packages:
|
|||||||
name: division
|
name: division
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.8"
|
version: "0.9.0"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -222,7 +243,28 @@ packages:
|
|||||||
name: flutter_bloc
|
name: flutter_bloc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.0"
|
version: "7.2.0"
|
||||||
|
flutter_launcher_icons:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_launcher_icons
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.2"
|
||||||
|
flutter_native_splash:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_native_splash
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.1"
|
||||||
|
flutter_slidable:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_slidable
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -233,6 +275,13 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
frontend_server_client:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: frontend_server_client
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -246,28 +295,28 @@ packages:
|
|||||||
name: graphs
|
name: graphs
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "2.0.0"
|
||||||
html:
|
html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: html
|
name: html
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.14.0+4"
|
version: "0.15.0"
|
||||||
html_unescape:
|
html_unescape:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: html_unescape
|
name: html_unescape
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "2.0.0"
|
||||||
http:
|
http:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.2"
|
version: "0.13.3"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -281,7 +330,14 @@ packages:
|
|||||||
name: http_parser
|
name: http_parser
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "4.0.0"
|
||||||
|
image:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -316,21 +372,21 @@ packages:
|
|||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10"
|
version: "0.12.11"
|
||||||
mdi:
|
mdi:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: mdi
|
name: mdi
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0"
|
version: "5.0.0-nullsafety.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.7.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -422,6 +478,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.0"
|
version: "1.11.0"
|
||||||
|
petitparser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: petitparser
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.0"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -435,7 +498,7 @@ packages:
|
|||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "2.0.1"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -456,7 +519,7 @@ packages:
|
|||||||
name: provider
|
name: provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.0"
|
version: "6.0.0"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -471,13 +534,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
|
settings_ui:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: settings_ui
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: shared_preferences
|
name: shared_preferences
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.5"
|
version: "2.0.7"
|
||||||
shared_preferences_linux:
|
shared_preferences_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -519,14 +589,14 @@ packages:
|
|||||||
name: shelf
|
name: shelf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.9"
|
version: "1.2.0"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_web_socket
|
name: shelf_web_socket
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.4+1"
|
version: "1.0.1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -587,7 +657,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.0"
|
version: "0.4.3"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -602,20 +672,27 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
universal_io:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: universal_io
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.4"
|
||||||
unofficial_jisho_api:
|
unofficial_jisho_api:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: unofficial_jisho_api
|
name: unofficial_jisho_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "2.0.3"
|
||||||
url_launcher:
|
url_launcher:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.3"
|
version: "6.0.10"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -636,7 +713,7 @@ packages:
|
|||||||
name: url_launcher_platform_interface
|
name: url_launcher_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.4"
|
||||||
url_launcher_web:
|
url_launcher_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -686,6 +763,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
xml:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xml
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.0"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -694,5 +778,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.12.0 <3.0.0"
|
dart: ">=2.13.0 <3.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=2.0.0"
|
||||||
|
@ -41,6 +41,7 @@ flutter:
|
|||||||
|
|
||||||
assets:
|
assets:
|
||||||
- assets/images/denshi_jisho_background_overlay.png
|
- assets/images/denshi_jisho_background_overlay.png
|
||||||
|
- assets/images/logo/
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
# - images/a_dot_ham.jpeg
|
# - images/a_dot_ham.jpeg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user