mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-21 13:37:29 +01:00
Split search bar into component
This commit is contained in:
parent
4f6793c959
commit
f76f0011ad
32
lib/view/components/search/search_bar.dart
Normal file
32
lib/view/components/search/search_bar.dart
Normal file
@ -0,0 +1,32 @@
|
||||
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/view/components/search/LanguageSelector.dart';
|
||||
|
||||
class SearchBar extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
onSubmitted: (text) => BlocProvider.of<SearchBloc>(context)
|
||||
.add(GetSearchResults(text)),
|
||||
controller: TextEditingController(),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Search',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
LanguageSelector()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
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/view/components/search/LanguageSelector.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/components/search/search_result_page/search_card.dart';
|
||||
|
||||
@ -45,32 +45,3 @@ class _InitialView extends StatelessWidget {
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchBar extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
onSubmitted: (text) => BlocProvider.of<SearchBloc>(context)
|
||||
.add(GetSearchResults(text)),
|
||||
controller: TextEditingController(),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Search',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
LanguageSelector()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user