move files around

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-02 22:26:59 +01:00
parent 1a3acf80f1
commit d280f62c9f
32 changed files with 73 additions and 43 deletions

View File

@ -4,7 +4,7 @@ import './kanji_event.dart';
import './kanji_state.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';
export './kanji_event.dart';
@ -15,9 +15,8 @@ class KanjiBloc extends Bloc<KanjiEvent, KanjiState> {
KanjiBloc() : super(KanjiSearchInitial());
@override
Stream<KanjiState> mapEventToState(
KanjiEvent event,
) async* {
Stream<KanjiState> mapEventToState(KanjiEvent event)
async* {
if (event is GetKanji) {
yield KanjiSearchLoading();

View File

@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
part 'search_event.dart';

View File

@ -1,16 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_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/screens/history.dart';
import 'package:jisho_study_tool/screens/search.dart';
import 'package:jisho_study_tool/view/screens/kanji_search.dart';
import 'package:jisho_study_tool/view/screens/history.dart';
import 'package:jisho_study_tool/view/screens/search.dart';
import 'bloc/search/search_bloc.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(

View File

@ -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),
),
);
}
}

View File

@ -3,9 +3,9 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_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/components/kanji/kanji_suggestions.dart';
import 'package:jisho_study_tool/components/loading.dart';
import 'package:jisho_study_tool/view/components/kanji/kanji_search_result_page/kanji_search_result_page.dart';
import 'package:jisho_study_tool/view/components/kanji/kanji_search_suggestion_list/kanji_search_suggestion_list.dart';
import 'package:jisho_study_tool/view/screens/loading.dart';
class KanjiView extends StatelessWidget {
@override

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_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/components/search/search_card.dart';
import 'package:jisho_study_tool/view/components/search/LanguageSelector.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 {
@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 {
@override
@ -89,13 +68,7 @@ class SearchBar extends StatelessWidget {
SizedBox(
height: 10.0,
),
Row(
children: [
_LanguageOption('Auto', Colors.white),
_LanguageOption('English', Colors.white),
_LanguageOption('Japanese', Colors.blue),
],
),
LanguageSelector(["Auto", "Japanese", "English"])
],
),
);