diff --git a/Final_Result/add_page.png b/Final_Result/add_page.png new file mode 100644 index 0000000..cc433e8 Binary files /dev/null and b/Final_Result/add_page.png differ diff --git a/Final_Result/cart_page.png b/Final_Result/cart_page.png new file mode 100644 index 0000000..bfac859 Binary files /dev/null and b/Final_Result/cart_page.png differ diff --git a/Final_Result/detail_page.png b/Final_Result/detail_page.png new file mode 100644 index 0000000..efdcf5b Binary files /dev/null and b/Final_Result/detail_page.png differ diff --git a/Final_Result/filled_add_page.png b/Final_Result/filled_add_page.png new file mode 100644 index 0000000..c679aa4 Binary files /dev/null and b/Final_Result/filled_add_page.png differ diff --git a/Final_Result/main_page.png b/Final_Result/main_page.png new file mode 100644 index 0000000..4472660 Binary files /dev/null and b/Final_Result/main_page.png differ diff --git a/README.md b/README.md index 037e2ef..518d13f 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,6 @@ -# Task 3 - Book Store App +# Unicoding bootcamp - Book Store App -Task resolution process: - -- Fork the repo -- Clone the forked repo to your local machine -- Resolve the task -- Commit your solution -- Push to GitHub -- create a pull request - - - -### Task 3: -Build a book store mobile application. The store contain a list of available books with the ability to add custom books to the store as well as view, order them. - -* Don't use pre-made widgets (packges). -* It's ok to use icons packages. -* Use Getx for state management. - -## UI -### Main Page -The main page should contain a list of the available books. When tapping on a book, the second page (Book Details Page) will be navigated. Use Scrollable view for the list of books. ALso there is a simple search on the top of the page. - - -### Cart Page (Optional) -This page can view the ordered books. - -### Details Page -This have the details of the book which is: -- Book name -- Author -- Desciption -- Image -- Rate (constant) - -### Add Page -It is the page where you can add new books to the store. - -## FLow -1. Build the UI (from figma design). -2. seperate the widgets to small and organized files. -3. Build models that contain the book data (You can build one model or more). -4. Try to seperate the logic (Functions and data) from the UI. - -## Figma Design -https://www.figma.com/file/4BGkiFfTPT7b8K9pyFTBD6/Online-Book-Store-App-(2019)-(Community)?node-id=0%3A1 +

+ + +

diff --git a/WM-Screenshots-20220827212746.png b/WM-Screenshots-20220827212746.png new file mode 100644 index 0000000..4472660 Binary files /dev/null and b/WM-Screenshots-20220827212746.png differ diff --git a/WM-Screenshots-20220827220411.png b/WM-Screenshots-20220827220411.png new file mode 100644 index 0000000..efdcf5b Binary files /dev/null and b/WM-Screenshots-20220827220411.png differ diff --git a/images/Vector.png b/images/Vector.png new file mode 100644 index 0000000..8626ed4 Binary files /dev/null and b/images/Vector.png differ diff --git a/images/article.png b/images/article.png new file mode 100644 index 0000000..52d00ba Binary files /dev/null and b/images/article.png differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..e5b6214 Binary files /dev/null and b/images/home.png differ diff --git a/images/msg.png b/images/msg.png new file mode 100644 index 0000000..732999d Binary files /dev/null and b/images/msg.png differ diff --git a/images/pro.png b/images/pro.png new file mode 100644 index 0000000..7a4b085 Binary files /dev/null and b/images/pro.png differ diff --git a/images/search.png b/images/search.png new file mode 100644 index 0000000..505a5a4 Binary files /dev/null and b/images/search.png differ diff --git a/lib/main.dart b/lib/main.dart index bcc58f7..b3043cf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,6 @@ +import 'package:book_store_app/views/main_page/home_page.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; void main() { runApp(const MyApp()); @@ -9,12 +11,9 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp( - home: Scaffold( - body: Center( - child: Text("Book Store App"), - ), - ), + return const GetMaterialApp( + debugShowCheckedModeBanner: false, + home: HomePage(), ); } } diff --git a/lib/models/book_model.dart b/lib/models/book_model.dart new file mode 100644 index 0000000..ede28d7 --- /dev/null +++ b/lib/models/book_model.dart @@ -0,0 +1,59 @@ +import 'package:get/get.dart'; + +class Book { + String name; + String author; + double rate; + String description; + String price; + + String? imgLink; + + Book({ + required this.name, + required this.author, + required this.description, + required String price, + String? imgLink, + }) : imgLink = (imgLink == null) + ? 'https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Book-icon-bible.png/640px-Book-icon-bible.png' + : imgLink, + rate = 4.5, + price = '\$$price'; + + static RxList allBooks = [ + Book( + name: 'Yves Saint Laurent', + author: 'Suzy Menkes', + price: '46.99', + imgLink: + 'https://images-na.ssl-images-amazon.com/images/I/21KbioZVBDL._SX340_BO1,204,203,200_.jpg', + description: + "A spectacular visual journey through 40 years of haute couture from one of the best-known and most trend-setting brands in fashion."), + Book( + name: 'The Book of Signs', + author: 'Rudolf Koch', + price: '99.99', + description: + 'A spectacular visual journey through 40 years of haute couture from one of the best-known and most trend-setting brands in fashion.', + imgLink: + 'http://kbimages1-a.akamaihd.net/Images/0f23bd7a-4b80-49e8-a086-25fae5674dc4/255/400/False/image.jpg') + ].obs; + + static void addBook( + {required name, + required author, + required description, + required price, + String? imgLink}) { + allBooks.add(Book( + name: name, + author: author, + description: description, + price: price, + imgLink: imgLink)); + } + + static RxList addedToCardBooks = [].obs; + static RxBool isFiltered = false.obs; +} diff --git a/lib/views/adding_page/adding_page.dart b/lib/views/adding_page/adding_page.dart new file mode 100644 index 0000000..74e6183 --- /dev/null +++ b/lib/views/adding_page/adding_page.dart @@ -0,0 +1,103 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../models/book_model.dart'; +import '../common_widgets/app_bar.dart'; +import 'book_info_textfield.dart'; + +class BookBuilder extends StatelessWidget { + BookBuilder({Key? key}) : super(key: key); + + final TextEditingController bookNameController = TextEditingController(); + final TextEditingController authorController = TextEditingController(); + final TextEditingController priceController = TextEditingController(); + final TextEditingController imgController = TextEditingController(); + final TextEditingController descController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + backgroundColor: Color.fromARGB(255, 245, 245, 245), + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), + child: ListView( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + const MyAppBar(), + SizedBox( + height: 30, + ), + Row( + children: [ + Text('Add Book', + style: + TextStyle(fontSize: 24, fontWeight: FontWeight.w600)), + ], + ), + SizedBox( + height: 30, + ), + BookInfoTextField( + controller: bookNameController, text: 'Book Name'), + BookInfoTextField( + controller: authorController, text: 'Author Name'), + BookInfoTextField(controller: priceController, text: 'Price'), + BookInfoTextField(controller: imgController, text: 'Image Link'), + TextField( + minLines: 4, + maxLines: 5, + controller: descController, + decoration: InputDecoration( + hintText: 'Desciption', + filled: true, + fillColor: Color.fromARGB(235, 252, 252, 252), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + ), + ), + ), + SizedBox( + height: 15, + ), + Container( + width: 285, + height: 60, + decoration: BoxDecoration( + color: Colors.black, + borderRadius: BorderRadius.circular(22)), + child: ElevatedButton( + child: Text('Add'), + style: ButtonStyle( + shape: + MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(22.0), + )), + backgroundColor: + MaterialStateProperty.all(Colors.black)), + onPressed: () { + if ([ + bookNameController.text, + authorController.text, + descController.text, + priceController.text + ].every((element) => element.isNotEmpty)) { + Book.addBook( + name: bookNameController.text, + author: authorController.text, + description: descController.text, + imgLink: imgController.text, + price: priceController.text); + } + Get.back(); + }, + )) + ], + ), + ), + ), + ); + } +} diff --git a/lib/views/adding_page/book_info_textfield.dart b/lib/views/adding_page/book_info_textfield.dart new file mode 100644 index 0000000..ef9e9ee --- /dev/null +++ b/lib/views/adding_page/book_info_textfield.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +class BookInfoTextField extends StatelessWidget { + const BookInfoTextField({ + Key? key, + required this.controller, + required this.text, + }) : super(key: key); + + final String text; + final TextEditingController controller; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(bottom: 20), + child: TextField( + controller: controller, + decoration: InputDecoration( + hintText: text, + hintStyle: TextStyle(color: Color(0xff84889E)), + filled: true, + fillColor: Color.fromARGB(235, 252, 252, 252), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + ), + ), + ), + ); + } +} diff --git a/lib/views/book_datail/book_info_column.dart b/lib/views/book_datail/book_info_column.dart new file mode 100644 index 0000000..a9045b0 --- /dev/null +++ b/lib/views/book_datail/book_info_column.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +import '../../models/book_model.dart'; + +class BookInfo extends StatelessWidget { + const BookInfo({ + Key? key, + required this.book, + }) : super(key: key); + + final Book book; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + width: 216, + height: 320, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: NetworkImage(book.imgLink!), + ), + borderRadius: BorderRadius.circular(10)), + ), + const SizedBox( + height: 15, + ), + Text(book.name, + style: const TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: Colors.black)), + const SizedBox( + height: 7, + ), + Text(book.author, + style: const TextStyle( + fontSize: 14, + color: const Color.fromARGB(255, 101, 101, 101))), + ], + ); + } +} diff --git a/lib/views/book_datail/button_builder.dart b/lib/views/book_datail/button_builder.dart new file mode 100644 index 0000000..91d5ad1 --- /dev/null +++ b/lib/views/book_datail/button_builder.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; + +class ButtonBuilder extends StatelessWidget { + final IconData icon; + final String text; + + const ButtonBuilder({Key? key, required this.icon, required this.text}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(154, 40), + primary: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + ), + ), + onPressed: () {}, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon(icon, color: Colors.black), + Text(text, style: TextStyle(color: Colors.black)) + ], + )); + } +} \ No newline at end of file diff --git a/lib/views/book_datail/detail_page.dart b/lib/views/book_datail/detail_page.dart new file mode 100644 index 0000000..3c10b9c --- /dev/null +++ b/lib/views/book_datail/detail_page.dart @@ -0,0 +1,92 @@ +import 'package:book_store_app/views/book_datail/book_info_column.dart'; +import 'package:book_store_app/views/common_widgets/rate_stars.dart'; +import 'package:flutter/material.dart'; +import '../../models/book_model.dart'; +import '../common_widgets/app_bar.dart'; +import 'button_builder.dart'; + +class BookDetailsBuilder extends StatelessWidget { + const BookDetailsBuilder({Key? key, required this.book}) : super(key: key); + final Book book; + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), + child: Column( + children: [ + const MyAppBar(), + BookInfo(book: book), + const SizedBox( + height: 7, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: const [ + RateStars(), + Icon(Icons.star_rounded, + color: Color.fromARGB(255, 187, 186, 186), size: 20) + ], + ), + const SizedBox( + width: 10, + ), + Text( + book.rate.toString(), + style: const TextStyle( + fontWeight: FontWeight.bold, color: Colors.black), + ), + const Text('/5.0', + style: const TextStyle( + color: Color.fromARGB(255, 144, 143, 143))) + ], + ), + const SizedBox( + height: 7, + ), + const Flexible( + child: Text( + "A spectacular visual journey through 40 years of haute couture from one of the best-known and most trend-setting brands in fashion.", + style: TextStyle( + height: 1.8, color: Color.fromARGB(255, 119, 118, 118)), + )), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: const [ + ButtonBuilder(icon: Icons.article, text: 'Preview'), + ButtonBuilder(icon: Icons.message, text: 'Review') + ], + ), + ), + const SizedBox( + height: 20, + ), + ElevatedButton( + onPressed: () { + Book.addedToCardBooks.add(book); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('${book.name} has been added successfully'), + )); + }, + style: ElevatedButton.styleFrom( + minimumSize: const Size(319, 60), + primary: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + ), + child: Text('Buy Now for ${book.price}', + softWrap: true, + overflow: TextOverflow.visible, + style: const TextStyle(color: Colors.white)), + ) + ], + ), + )), + ); + } +} diff --git a/lib/views/cart_page/cart_page.dart b/lib/views/cart_page/cart_page.dart new file mode 100644 index 0000000..d84fb06 --- /dev/null +++ b/lib/views/cart_page/cart_page.dart @@ -0,0 +1,49 @@ +import 'package:book_store_app/models/book_model.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../common_widgets/app_bar.dart'; +import '../main_page/book_container.dart'; +import '../common_widgets/nav_bar.dart'; + +class AddedToCardBook extends StatelessWidget { + const AddedToCardBook({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), + child: Column( + children: [ + const MyAppBar(), + const SizedBox( + height: 20, + ), + Row( + children: const [ + Text('Cart', + style: + TextStyle(fontSize: 24, fontWeight: FontWeight.bold)), + ], + ), + const SizedBox( + height: 40, + ), + Obx(() { + return Expanded( + child: ListView( + children: Book.addedToCardBooks + .map((element) => BookContainer(book: element)) + .toList(), + ), + ); + }), + const NavBar() + ], + ), + ), + ), + ); + } +} diff --git a/lib/views/common_widgets/app_bar.dart b/lib/views/common_widgets/app_bar.dart new file mode 100644 index 0000000..c2a1c68 --- /dev/null +++ b/lib/views/common_widgets/app_bar.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class MyAppBar extends StatelessWidget { + const MyAppBar({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + onPressed: () { + Get.back(); + }, + icon: Icon( + Icons.arrow_back_ios, + color: Colors.black, + )), + Container( + height: 18, + width: 4, + child: Image(image: AssetImage('images/Vector.png'))) + ], + ); + } +} diff --git a/lib/views/common_widgets/nav_bar.dart b/lib/views/common_widgets/nav_bar.dart new file mode 100644 index 0000000..32ead9d --- /dev/null +++ b/lib/views/common_widgets/nav_bar.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../adding_page/adding_page.dart'; +import '../cart_page/cart_page.dart'; +import '../main_page/home_page.dart'; + +class NavBar extends StatefulWidget { + const NavBar({Key? key}) : super(key: key); + + @override + _NavBarState createState() => _NavBarState(); +} + +class _NavBarState extends State { + int selectedPageIndex = 0; + @override + Widget build(BuildContext context) { + return Container( + height: 72, + width: 227, + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 4, + blurRadius: 32, + ) + ], color: Colors.white, borderRadius: BorderRadius.circular(22)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 18, + width: 18, + child: FloatingActionButton( + heroTag: 'Home-button', + backgroundColor: Colors.transparent, + elevation: 0, + child: + Image(image: AssetImage('images/home.png')), + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + onPressed: () { + Get.to(() => const HomePage()); + }, + ), + ), + SizedBox(width: 30), + FloatingActionButton( + heroTag: 'shop-button', + backgroundColor: Colors.transparent, + elevation: 0, + child: Icon(Icons.shopping_cart_outlined, color: Colors.black), + onPressed: () { + Get.to(() => AddedToCardBook()); + }, + ), + FloatingActionButton( + heroTag: 'add-button', + backgroundColor: Colors.transparent, + elevation: 0, + child: Icon(Icons.add, color: Colors.black), + onPressed: () { + Get.to(() => BookBuilder()); + }, + ), + ], + ), + ); + } +} diff --git a/lib/views/common_widgets/rate_stars.dart b/lib/views/common_widgets/rate_stars.dart new file mode 100644 index 0000000..eb8e765 --- /dev/null +++ b/lib/views/common_widgets/rate_stars.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class RateStars extends StatelessWidget { + const RateStars({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Wrap( + children: List.generate(4, (int index) { + return Icon(Icons.star_rounded, color: Color(0xffFFC41F), size: 20); + })); + } +} diff --git a/lib/views/main_page/book_container.dart b/lib/views/main_page/book_container.dart new file mode 100644 index 0000000..5c23123 --- /dev/null +++ b/lib/views/main_page/book_container.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../models/book_model.dart'; +import '../book_datail/detail_page.dart'; +import '../common_widgets/rate_stars.dart'; + +class BookContainer extends StatelessWidget { + BookContainer({Key? key, required this.book}) : super(key: key); + + Book book; + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 20), + child: GestureDetector( + onTap: () { + Get.to(() => BookDetailsBuilder(book: book)); + }, + child: Row( + children: [ + Container( + height: 106, + width: 72, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: NetworkImage(book.imgLink!), + ), + borderRadius: BorderRadius.circular(5)), + ), + const SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(book.name, + style: const TextStyle( + fontWeight: FontWeight.bold, fontSize: 17)), + const SizedBox( + height: 7, + ), + Text(book.author), + const SizedBox( + height: 7, + ), + Text(book.price, + style: const TextStyle( + fontSize: 14, fontWeight: FontWeight.w500)), + const SizedBox( + height: 7, + ), + Row( + children: const [ + RateStars(), + Icon(Icons.star_rounded, + color: Color.fromARGB(255, 187, 186, 186), size: 20) + ], + ) + ], + ), + ], + ), + )); + } +} diff --git a/lib/views/main_page/home_page.dart b/lib/views/main_page/home_page.dart new file mode 100644 index 0000000..99b3afa --- /dev/null +++ b/lib/views/main_page/home_page.dart @@ -0,0 +1,73 @@ +import 'package:book_store_app/views/main_page/profile_row.dart'; +import 'package:book_store_app/views/main_page/search.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../models/book_model.dart'; +import '../common_widgets/nav_bar.dart'; +import 'book_container.dart'; + + +class HomePage extends StatelessWidget { + const HomePage({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + backgroundColor: const Color.fromARGB(255, 245, 245, 245), + body: Padding( + padding: const EdgeInsets.all(30.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + const ProfileRow(), + const SizedBox( + height: 30, + ), + SearchTextField(), + const SizedBox( + height: 30, + ), + Row( + children: const [ + Text('Book List', + style: TextStyle( + fontSize: 24, fontWeight: FontWeight.bold)), + ], + ), + const SizedBox( + height: 30, + ), + Expanded( + child: Obx(() { + return Book.isFiltered.value + ? ListView( + children: Book.allBooks + .where((eachBook) => eachBook.name + .toLowerCase() + .contains(SearchTextField + .searchInputController.text)) + .map((eachBook) => BookContainer( + book: eachBook, + )) + .toList(), + ) + : ListView( + children: Book.allBooks + .map((eachBook) => BookContainer( + book: eachBook, + )) + .toList(), + ); + }), + ), + ]), + ), + floatingActionButtonLocation: + FloatingActionButtonLocation.centerFloat, + floatingActionButton: const NavBar()), + ); + } +} diff --git a/lib/views/main_page/profile_row.dart b/lib/views/main_page/profile_row.dart new file mode 100644 index 0000000..5defa10 --- /dev/null +++ b/lib/views/main_page/profile_row.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +class ProfileRow extends StatelessWidget { + const ProfileRow({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Container( + height: 40, + width: 40, + child: const Image(image: AssetImage('images/pro.png')), + ), + const SizedBox( + width: 10, + ), + const Text('Hi,Ali!', + style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), + const Spacer(), + Container( + height: 18, + width: 4, + child: const Image(image: AssetImage('images/Vector.png'))) + ], + ); + } +} diff --git a/lib/views/main_page/search.dart b/lib/views/main_page/search.dart new file mode 100644 index 0000000..84d96ed --- /dev/null +++ b/lib/views/main_page/search.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import '../../models/book_model.dart'; + +class SearchTextField extends StatelessWidget { + SearchTextField({ + Key? key, + }) : super(key: key); + + static TextEditingController searchInputController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: TextField( + controller: SearchTextField.searchInputController, + decoration: InputDecoration( + filled: true, + fillColor: Color.fromARGB(212, 252, 252, 252), + hintText: 'Search...', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + ), + suffixIcon: const Image( + width: 20.31, + height: 20.31, + image: AssetImage('images/search.png'))), + onChanged: (input) { + Book.isFiltered.value = true; + }, + onEditingComplete: () { + Book.isFiltered.value = false; + FocusScope.of(context).unfocus(); + SearchTextField.searchInputController.clear(); + }, + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 7bc8bdd..0b90135 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -74,6 +74,13 @@ packages: description: flutter source: sdk version: "0.0.0" + get: + dependency: "direct main" + description: + name: get + url: "https://pub.dartlang.org" + source: hosted + version: "4.6.5" lints: dependency: transitive description: @@ -164,4 +171,4 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.17.6 <3.0.0" + dart: ">=2.17.0-206.0.dev <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index cd0f457..6ad552c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.17.6 <3.0.0" + sdk: ">=2.14.0-0 <3.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -34,6 +34,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + get : any dev_dependencies: flutter_test: @@ -58,8 +59,8 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg + assets: + - images/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see