From 0a9dba4d2e6e463fec34d4bc15a8fe2bbcbbde26 Mon Sep 17 00:00:00 2001 From: h7x4abk3g Date: Mon, 13 Jul 2020 21:38:24 +0200 Subject: [PATCH] Move searchbar --- lib/components/search_bar.dart | 59 ---------------------------------- lib/screens/search.dart | 57 +++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 60 deletions(-) delete mode 100644 lib/components/search_bar.dart diff --git a/lib/components/search_bar.dart b/lib/components/search_bar.dart deleted file mode 100644 index 36fecd6..0000000 --- a/lib/components/search_bar.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/material.dart'; - -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 - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 20.0), - child: Column( - children: [ - TextField( - controller: TextEditingController(), - decoration: InputDecoration( - labelText: 'Search', - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10.0), - ), - ), - ), - SizedBox( - height: 10.0, - ), - Row( - children: [ - _LanguageOption('Auto', Colors.white), - _LanguageOption('English', Colors.white), - _LanguageOption('Japanese', Colors.blue), - ], - ), - ], - ), - ); - } -} diff --git a/lib/screens/search.dart b/lib/screens/search.dart index fbf9b9f..a28cc49 100644 --- a/lib/screens/search.dart +++ b/lib/screens/search.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:jisho_study_tool/components/search_bar.dart'; class SearchView extends StatelessWidget { @override @@ -11,4 +10,60 @@ class SearchView 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 + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Column( + children: [ + TextField( + controller: TextEditingController(), + decoration: InputDecoration( + labelText: 'Search', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + ), + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + _LanguageOption('Auto', Colors.white), + _LanguageOption('English', Colors.white), + _LanguageOption('Japanese', Colors.blue), + ], + ), + ], + ), + ); + } } \ No newline at end of file