move files around
This commit is contained in:
parent
1a3acf80f1
commit
d280f62c9f
|
@ -4,7 +4,7 @@ import './kanji_event.dart';
|
||||||
import './kanji_state.dart';
|
import './kanji_state.dart';
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:jisho_study_tool/services/kanji_search.dart';
|
import 'package:jisho_study_tool/services/jisho_api/kanji_search.dart';
|
||||||
import 'package:jisho_study_tool/services/kanji_suggestions.dart';
|
import 'package:jisho_study_tool/services/kanji_suggestions.dart';
|
||||||
|
|
||||||
export './kanji_event.dart';
|
export './kanji_event.dart';
|
||||||
|
@ -15,9 +15,8 @@ class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
|
||||||
KanjiBloc() : super(KanjiSearchInitial());
|
KanjiBloc() : super(KanjiSearchInitial());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<KanjiState> mapEventToState(
|
Stream<KanjiState> mapEventToState(KanjiEvent event)
|
||||||
KanjiEvent event,
|
async* {
|
||||||
) async* {
|
|
||||||
if (event is GetKanji) {
|
if (event is GetKanji) {
|
||||||
|
|
||||||
yield KanjiSearchLoading();
|
yield KanjiSearchLoading();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import 'package:jisho_study_tool/services/jisho_search.dart';
|
import 'package:jisho_study_tool/services/jisho_api/jisho_search.dart';
|
||||||
import 'package:unofficial_jisho_api/parser.dart';
|
import 'package:unofficial_jisho_api/parser.dart';
|
||||||
|
|
||||||
part 'search_event.dart';
|
part 'search_event.dart';
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
||||||
import 'package:jisho_study_tool/screens/kanji_search.dart';
|
import 'package:jisho_study_tool/view/screens/kanji_search.dart';
|
||||||
import 'package:jisho_study_tool/screens/history.dart';
|
import 'package:jisho_study_tool/view/screens/history.dart';
|
||||||
import 'package:jisho_study_tool/screens/search.dart';
|
import 'package:jisho_study_tool/view/screens/search.dart';
|
||||||
|
|
||||||
import 'bloc/search/search_bloc.dart';
|
import 'bloc/search/search_bloc.dart';
|
||||||
|
|
||||||
void main() => runApp(MyApp());
|
void main() => runApp(MyApp());
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
// This widget is the root of your application.
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LanguageSelector extends StatefulWidget {
|
||||||
|
final List<String> _languages;
|
||||||
|
|
||||||
|
LanguageSelector(this._languages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
LanguageSelectorState createState() => new LanguageSelectorState(this._languages);
|
||||||
|
}
|
||||||
|
|
||||||
|
class LanguageSelectorState extends State<LanguageSelector> {
|
||||||
|
final List<String> _languages;
|
||||||
|
List<bool> isSelected = [true, false, false];
|
||||||
|
|
||||||
|
LanguageSelectorState(this._languages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
isSelected = [true, false, false];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ToggleButtons(
|
||||||
|
children: <Widget>[
|
||||||
|
LanguageOption("Auto"),
|
||||||
|
LanguageOption("Japanese"),
|
||||||
|
LanguageOption("English")
|
||||||
|
],
|
||||||
|
isSelected: isSelected
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class LanguageOption extends StatelessWidget {
|
||||||
|
final String _language;
|
||||||
|
|
||||||
|
LanguageOption(this._language);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
child: Center(child: Text(_language)),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.black,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
color: Colors.white),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,9 +3,9 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
import 'package:jisho_study_tool/bloc/kanji/kanji_bloc.dart';
|
||||||
import 'package:jisho_study_tool/components/kanji/kanji__search_page/kanji_search_page.dart';
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_result_page/kanji_search_result_page.dart';
|
||||||
import 'package:jisho_study_tool/components/kanji/kanji_suggestions.dart';
|
import 'package:jisho_study_tool/view/components/kanji/kanji_search_suggestion_list/kanji_search_suggestion_list.dart';
|
||||||
import 'package:jisho_study_tool/components/loading.dart';
|
import 'package:jisho_study_tool/view/screens/loading.dart';
|
||||||
|
|
||||||
class KanjiView extends StatelessWidget {
|
class KanjiView extends StatelessWidget {
|
||||||
@override
|
@override
|
|
@ -1,8 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
import 'package:jisho_study_tool/bloc/search/search_bloc.dart';
|
||||||
import 'package:jisho_study_tool/components/loading.dart';
|
import 'package:jisho_study_tool/view/components/search/LanguageSelector.dart';
|
||||||
import 'package:jisho_study_tool/components/search/search_card.dart';
|
import 'package:jisho_study_tool/view/screens/loading.dart';
|
||||||
|
import 'package:jisho_study_tool/view/components/search/search_card.dart';
|
||||||
|
|
||||||
class SearchView extends StatelessWidget {
|
class SearchView extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
|
@ -45,28 +46,6 @@ class _InitialView extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LanguageOption extends StatelessWidget {
|
|
||||||
final String _language;
|
|
||||||
final Color _color;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
|
||||||
child: Center(child: Text(_language)),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
color: Colors.black,
|
|
||||||
width: 1.0,
|
|
||||||
),
|
|
||||||
color: _color),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LanguageOption(this._language, this._color);
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchBar extends StatelessWidget {
|
class SearchBar extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
|
@ -89,13 +68,7 @@ class SearchBar extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.0,
|
height: 10.0,
|
||||||
),
|
),
|
||||||
Row(
|
LanguageSelector(["Auto", "Japanese", "English"])
|
||||||
children: [
|
|
||||||
_LanguageOption('Auto', Colors.white),
|
|
||||||
_LanguageOption('English', Colors.white),
|
|
||||||
_LanguageOption('Japanese', Colors.blue),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
Loading…
Reference in New Issue