Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hasan Issa #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Task_3
HasanIssa9 committed Aug 28, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b9b519f2511e6bc4f70d60624ac378f2031129c5
29 changes: 26 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import 'package:book_store_app/page_add/add_page.dart';
import 'package:book_store_app/page_cart/cart_page.dart';
import 'package:book_store_app/page_main/navigation_buttons.dart';
import 'package:book_store_app/page_save/save_page.dart';
import 'package:get/get.dart';

import '../page_main/main_page.dart';
import 'package:flutter/material.dart';

void main() {
@@ -7,13 +14,29 @@ void main() {
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

static PageController controllerPage = PageController();
static RxInt currentPage = 0.obs;

@override
Widget build(BuildContext context) {
return const MaterialApp(
return GetMaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Text("Book Store App"),
body: PageView(
controller: controllerPage,
onPageChanged: (x) {
currentPage.value = x;
print('x=${currentPage.value}');
},
children: [
const MainPage(),
const CartPage(),
const SavePage(),
AddPage(),
],
),
extendBody: true,
bottomNavigationBar: const NavigationButton(),
),
);
}
1 change: 1 addition & 0 deletions lib/modules/book_module.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:get/get.dart';class BookModule { final Rx<String> nameBook; final Rx<String> authorBook; final Rx<String> descriptionBook; final Rx<String> priceBook; final String imageBook; final RxBool inCart = false.obs; final RxBool isSaving = false.obs; static final RxBool isSearch = false.obs; BookModule( {required String nameBook, required String authorBook, required String priceBook, required String descriptionBook, required this.imageBook}) : nameBook = nameBook.obs, authorBook = authorBook.obs, priceBook = priceBook.obs, descriptionBook = descriptionBook.obs; inCartChanged() { inCart.value = true; } isSavingChanged() { isSaving.value = true; } static isSearchChanged() { isSearch.value = true; } static RxString search = ''.obs; static add(String name, String author, String price, String description, String image) { BookModule book = BookModule( nameBook: name, authorBook: author, priceBook: price, descriptionBook: description, imageBook: image, ); books.add(book); } static RxList<BookModule> books = <BookModule>[ BookModule( nameBook: 'Overkill', authorBook: 'Sandra Brown', priceBook: '14.99', descriptionBook: '''Former Super Bowl MVP quarterback Zach Bridger hasn’t seen his ex-wife, Rebecca Pratt, for some time—not since their volatile marriage imploded—so he’s shocked to receive a life-altering call about her. Rebecca has been placed on life support after a violent assault, and he—despite their divorce—has medical power-of-attorney. Zach is asked to make an impossible choice: keep her on life support or take her off of it. Buckling under the weight of the responsibility and the glare of public scrutiny, Zach ultimately walks away, letting Rebecca's parents have the final say.''', imageBook: 'https://books.google.com/books/publisher/content/images/frontcover/DZ5kEAAAQBAJ?fife=w240-h345'), BookModule( nameBook: 'Soul Taken', authorBook: 'Patricia Briggs', priceBook: '13.99', descriptionBook: '''The vampire Wulfe is missing. Since he’s deadly, possibly insane, and his current idea of “fun” is stalking me, some may see it as no great loss. But, warned that his disappearance might bring down the carefully constructed alliances that keep our pack safe, my mate and I must find Wulfe—and hope he’s still alive. As alive as a vampire can be, anyway''', imageBook: 'https://books.google.com/books/publisher/content/images/frontcover/YkAyEAAAQBAJ?fife=w240-h345'), BookModule( nameBook: 'Verity', authorBook: 'Colleen Hoover', priceBook: '11.99', descriptionBook: '''Whose truth is the lie? Stay up all night reading the sensational psychological thriller that has readers obsessed, ''', imageBook: 'https://books.google.com/books/publisher/content/images/frontcover/SSRGEAAAQBAJ?fife=w240-h345'), BookModule( nameBook: 'The Terminal List: A Thriller', authorBook: 'Jack Carr', priceBook: '18.99', descriptionBook: '''Take my word for it, James Reece is one rowdy motherf***er. Get ready!”—Chris Pratt, all around great guy and star of The Terminal List, coming to Amazon PrimeA Navy SEAL has nothing left to live for and everything to kill for after he discovers that the American government is behind the deaths''', imageBook: 'https://books.google.com/books/publisher/content/images/frontcover/0BwyDwAAQBAJ?fife=w240-h345'), BookModule( nameBook: 'In the Blood: A Thriller', authorBook: 'Jack Carr', priceBook: '14.99', descriptionBook: '''Take my word for it, James Reece is one rowdy motherf***er. Get ready!” —Chris Pratt, star of The Terminal List, coming to Amazon PrimeThe #1 New York Times bestselling Terminal List series continues as James Reece embarks on a global journey of vengeance.A woman boards a plane in the African country of Burkina Faso having just completed a targeted assassination ''', imageBook: 'https://books.google.com/books/publisher/content/images/frontcover/TFg1EAAAQBAJ?fife=w240-h345'), ].obs;}
1 change: 1 addition & 0 deletions lib/page_add/add_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_add/button_add.dart';import 'package:book_store_app/page_add/text_add.dart';import 'package:book_store_app/page_description/custom_appbar.dart';import 'package:book_store_app/page_main/title_page.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class AddPage extends StatelessWidget { AddPage({Key? key}) : super(key: key); final TextEditingController name = TextEditingController(); final TextEditingController author = TextEditingController(); final TextEditingController price = TextEditingController(); final TextEditingController image = TextEditingController(); final TextEditingController description = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( appBar: const CustomAppBar(), body: SingleChildScrollView( child: SizedBox( height: 600, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ const TitlePage(title: 'Add Book'), TextAdd(controllerAdd: name, hintText: 'Book Name', height: 50), TextAdd( controllerAdd: author, hintText: 'Author Name', height: 50), TextAdd(controllerAdd: price, hintText: 'Price', height: 50), TextAdd(controllerAdd: image, hintText: 'Image Link', height: 50), TextAdd( controllerAdd: description, hintText: 'Description', height: 150), ButtonAdd( addBook: () { BookModule.add( name.text, author.text, price.text, description.text, image.text, ); name.clear(); author.clear(); price.clear(); image.clear(); description.clear(); }, ), ], ), ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_add/button_add.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import '../modules/book_module.dart';class ButtonAdd extends StatelessWidget { const ButtonAdd({ Key? key, required this.addBook, }) : super(key: key); final Function addBook; @override Widget build(BuildContext context) { return Center( child: TextButton( onPressed: () { addBook(); }, child: Container( height: 50, width: 280, decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(12), ), child: const Center( child: Text( 'Add', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), )), ))); }}
1 change: 1 addition & 0 deletions lib/page_add/text_add.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';class TextAdd extends StatelessWidget { const TextAdd({ Key? key, required this.controllerAdd, required this.hintText, required this.height, }) : super(key: key); final TextEditingController controllerAdd; final String hintText; final double height; @override Widget build(BuildContext context) { return Container( height: height, margin: const EdgeInsets.only(top: 15, right: 25, left: 25), decoration: BoxDecoration(boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), spreadRadius: 1, blurRadius: 9, offset: const Offset(0, 6), // changes position of shadow ), ]), child: TextField( maxLines: 7, controller: controllerAdd, style: const TextStyle( fontSize: 18, ), decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide.none, ), filled: true, fillColor: Colors.white, hintText: hintText, contentPadding: const EdgeInsets.only(left: 20.0, bottom: 16.0, top: 16.0), hintStyle: const TextStyle( color: Colors.grey, fontSize: 20, fontStyle: FontStyle.italic, ), ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_cart/cart_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/page_description/custom_appbar.dart';import 'package:book_store_app/page_main/title_page.dart';import 'package:flutter/material.dart';import '../page_main/navigation_buttons.dart';import 'list_cart.dart';class CartPage extends StatelessWidget { const CartPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: const CustomAppBar(), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ TitlePage(title: 'Cart'), ListCart(), ], ), extendBody: true, bottomNavigationBar: const NavigationButton(), ); }}
1 change: 1 addition & 0 deletions lib/page_cart/list_cart.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_description/book_info.dart';import 'package:book_store_app/page_main/list_book_layout.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class ListCart extends StatelessWidget { const ListCart({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: Obx(() { return Padding( padding: const EdgeInsets.only(left: 20), child: ListView( scrollDirection: Axis.vertical, shrinkWrap: true, children: BookModule.books .where((e) => e.inCart.value) .map((e) => GestureDetector( onTap: () { Get.to(BookInfo(book: e)); }, child: ListBookLayout(book: e), )) .toList(), ), ); }), ); }}
1 change: 1 addition & 0 deletions lib/page_description/book_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_description/bottom_button.dart';import 'package:book_store_app/page_description/description.dart';import 'package:book_store_app/page_description/image_book.dart';import 'package:flutter/material.dart';import 'custom_appbar.dart';import 'buttons.dart';class BookInfo extends StatelessWidget { BookInfo({ Key? key, required this.book, }) : super(key: key); final BookModule book; @override Widget build(BuildContext context) { return Scaffold( appBar: const CustomAppBar(), body: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ImageBook(book: book), Text( book.nameBook.value, style: const TextStyle(fontSize: 26, fontWeight: FontWeight.bold), ), Text( book.authorBook.value, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, color: Colors.grey), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: List.generate(5, (index) { return Icon( index < 4 ? Icons.star : Icons.star_border, color: Colors.yellow, ); }), ), DescriptionBook(book: book), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ Buttons( iconButton: Icons.short_text_rounded, nameButton: 'Preview', ), Buttons( iconButton: Icons.message_outlined, nameButton: 'Reviews', ), ], ), BottomButton(book: book), ], ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_description/bottom_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import 'package:get/get.dart';import '../modules/book_module.dart';class BottomButton extends StatelessWidget { const BottomButton({ Key? key, required this.book, }) : super(key: key); final BookModule book; @override Widget build(BuildContext context) { return Obx(() { return TextButton( onPressed: () { (book.inCart.value == true) ? book.inCart.value = false : book.inCartChanged(); }, child: Container( height: 50, width: 280, decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.circular(12), ), child: Center( child: Text( (book.inCart.value == false) ? 'Buy Now for \$${book.priceBook}' : 'Remove from Cart', style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), )), )); }); }}
1 change: 1 addition & 0 deletions lib/page_description/buttons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';class Buttons extends StatelessWidget { const Buttons({Key? key, required this.iconButton, required this.nameButton}) : super(key: key); final IconData iconButton; final String nameButton; @override Widget build(BuildContext context) { return TextButton( onPressed: () {}, style: TextButton.styleFrom( backgroundColor: Colors.white, padding: const EdgeInsets.only(left: 25,right: 25,top: 10,bottom: 10), ), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Icon(iconButton,color: Colors.black,), SizedBox(width: 8,), Text(nameButton,style: const TextStyle(color: Colors.black,fontSize: 14),), ], ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_description/custom_appbar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:get/get.dart';class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { const CustomAppBar({Key? key}) : super(key: key); @override Size get preferredSize => const Size.fromHeight(50.0); @override Widget build(BuildContext context) { return AppBar( systemOverlayStyle: const SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarIconBrightness: Brightness.dark), elevation: 0, backgroundColor: Colors.white, leading: GestureDetector( child: const Icon( Icons.arrow_back_ios, color: Colors.black, ), onTap: () { Get.back(); }, ), actions: const [ Padding( padding: EdgeInsets.only(right: 15), child: Icon( Icons.more_vert, color: Colors.black, ), ) ], ); }}
1 change: 1 addition & 0 deletions lib/page_description/description.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import '../modules/book_module.dart';class DescriptionBook extends StatelessWidget { const DescriptionBook({Key? key, required this.book}) : super(key: key); final BookModule book; @override Widget build(BuildContext context) { return SizedBox( height: 100, child: SingleChildScrollView( child: Container( margin: const EdgeInsets.only(right: 25, left: 25), padding: const EdgeInsets.all(15), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10) ), child: Text(book.descriptionBook.value,style: const TextStyle(fontWeight: FontWeight.bold),), ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_description/image_book.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import '../modules/book_module.dart';class ImageBook extends StatelessWidget { const ImageBook({Key? key, required this.book}) : super(key: key); final BookModule book; @override Widget build(BuildContext context) { return Container( width: 200, height: 300, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), image: DecorationImage( fit: BoxFit.fill, image: NetworkImage( book.imageBook, ), ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_main/list_book_layout.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class ListBookLayout extends StatelessWidget { const ListBookLayout({Key? key, required this.book}) : super(key: key); final BookModule book; @override Widget build(BuildContext context) { return Row( children: [ Container( width: 75, height: 135, margin: const EdgeInsets.only(top: 10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), image: DecorationImage( fit: BoxFit.fill, image: NetworkImage( book.imageBook, ), ), ), ), const SizedBox( width: 20, ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( book.nameBook.value, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), const SizedBox( height: 12, ), Text(book.authorBook.value), const SizedBox( height: 5, ), Text( '\$${book.priceBook.value}', style: const TextStyle(fontWeight: FontWeight.bold), ), const SizedBox(), Row( children: List.generate(5, (index) { return Icon( index < 4 ? Icons.star : Icons.star_border, color: Colors.yellow, ); }), ), ], )), Obx(() { return IconButton( onPressed: () { (book.isSaving.value == true) ? book.isSaving.value = false : book.isSavingChanged(); }, icon: (book.isSaving.value == false) ? const Icon(Icons.bookmark_border_outlined) : const Icon(Icons.bookmark), ); }), const SizedBox( width: 10, ) ], ); }}
1 change: 1 addition & 0 deletions lib/page_main/list_books.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_description/book_info.dart';import 'package:book_store_app/page_main/list_book_layout.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class ListBooks extends StatelessWidget { const ListBooks({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: Obx(() { return Padding( padding: const EdgeInsets.only(left: 20), child: ListView( scrollDirection: Axis.vertical, shrinkWrap: true, children: BookModule.books .map( (e) => GestureDetector( onTap: () { Get.to(() => BookInfo(book: e)); }, child: ListBookLayout(book: e), ), ) .toList(), ), ); }), ); }}
1 change: 1 addition & 0 deletions lib/page_main/main_appbar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';import 'package:flutter/services.dart';class AppBarMain extends StatelessWidget implements PreferredSizeWidget { const AppBarMain({Key? key}) : super(key: key); @override // TODO: implement preferredSize Size get preferredSize => const Size.fromHeight(50); @override Widget build(BuildContext context) { return AppBar( systemOverlayStyle: const SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarIconBrightness: Brightness.dark), backgroundColor: Colors.white, elevation: 0, leading: Container( margin: const EdgeInsets.only( left: 10, top: 3, bottom: 3, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), image: const DecorationImage( fit: BoxFit.fill, image: NetworkImage( 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTE9gCgTvs1TnWOt9Y1Q83CchVzZxz4e-0n1A&usqp=CAU', ), ), ), ), title: const Text( 'Hi,Hasan !', style: TextStyle(color: Colors.black), ), actions: const [ Padding( padding: EdgeInsets.only(right: 15), child: Icon( Icons.more_vert, color: Colors.black, ), ) ], ) ; }}
1 change: 1 addition & 0 deletions lib/page_main/main_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_main/list_books.dart';import 'package:book_store_app/page_main/main_appbar.dart';import 'package:book_store_app/page_main/navigation_buttons.dart';import 'package:book_store_app/page_main/search_field.dart';import 'package:book_store_app/page_main/search_list.dart';import 'package:book_store_app/page_main/title_page.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class MainPage extends StatelessWidget { const MainPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: const AppBarMain(), backgroundColor: Colors.white, body: Obx(() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SearchField(), TitlePage( title: (BookModule.isSearch.value == false) ? 'Books List' : 'Result'), (BookModule.isSearch.value == false) ? const ListBooks() : const SearchList(), ], ); }), extendBody: true, bottomNavigationBar: const NavigationButton(), ); }}
1 change: 1 addition & 0 deletions lib/page_main/navigation_buttons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/main.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class NavigationButton extends StatelessWidget { const NavigationButton({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(bottom: 25, left: 85, right: 85), child: Container( width: 200, height: 55, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 1, blurRadius: 9, offset: const Offset(0, 6), // changes position of shadow ), ]), child: Obx(() { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( onPressed: () { MyApp.controllerPage.animateToPage( 0, duration: const Duration(milliseconds: 200), curve: Curves.linear, ); }, icon: (MyApp.currentPage.value == 0) ? const Icon( Icons.home_outlined, size: 30, color: Colors.blue, ) : const Icon(Icons.home_outlined), ), IconButton( onPressed: () { MyApp.controllerPage.animateToPage( 1, duration: const Duration(milliseconds: 200), curve: Curves.linear, ); }, icon: (MyApp.currentPage.value == 1) ? const Icon( Icons.shopping_cart_outlined, size: 30, color: Colors.blue, ) : const Icon(Icons.shopping_cart_outlined), ), IconButton( onPressed: () { MyApp.controllerPage.animateToPage( 2, duration: const Duration(milliseconds: 200), curve: Curves.linear, ); }, icon: (MyApp.currentPage.value == 2) ? const Icon( Icons.bookmark, size: 30, color: Colors.blue, ) : const Icon(Icons.bookmark), ), IconButton( onPressed: () { MyApp.controllerPage.animateToPage( 3, duration: const Duration(milliseconds: 200), curve: Curves.linear, ); }, icon: (MyApp.currentPage.value == 3) ? const Icon( Icons.add, size: 30, color: Colors.blue, ) : const Icon(Icons.add), ), ], ); }), ), ); }}
1 change: 1 addition & 0 deletions lib/page_main/search_field.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class SearchField extends StatelessWidget { SearchField({Key? key}) : super(key: key); final TextEditingController controllerSearch = TextEditingController(); @override Widget build(BuildContext context) { return Container( height: 50, margin: const EdgeInsets.only(top: 15, right: 25, left: 25), decoration: BoxDecoration(boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 1, blurRadius: 9, offset: const Offset(0, 6), // changes position of shadow ), ]), child: TextField( controller: controllerSearch, style: const TextStyle( fontSize: 18, ), decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), borderSide: BorderSide.none, ), suffixIcon: IconButton( onPressed: () { BookModule.search.value=controllerSearch.text; (BookModule.isSearch.value == true) ? BookModule.isSearch.value = false : BookModule.isSearchChanged(); }, icon: const Icon(Icons.search_rounded), iconSize: 35, ), filled: true, fillColor: Colors.white, hintText: 'Search...', contentPadding: const EdgeInsets.only(left: 14.0, bottom: 8.0, top: 8.0), hintStyle: const TextStyle( color: Colors.grey, fontSize: 20, fontStyle: FontStyle.italic, ), ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_main/search_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_description/book_info.dart';import 'package:book_store_app/page_main/list_book_layout.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class SearchList extends StatelessWidget { const SearchList({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: Obx(() { return Padding( padding: const EdgeInsets.only(left: 20), child: ListView( scrollDirection: Axis.vertical, shrinkWrap: true, children: BookModule.books .where( (e) => e.nameBook.value.toLowerCase().contains(BookModule.search) == true) .map( (e) => GestureDetector( onTap: () { Get.to(() => BookInfo(book: e)); }, child: ListBookLayout(book: e), ), ) .toList(), ), ); }), ); }}
1 change: 1 addition & 0 deletions lib/page_main/title_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:flutter/material.dart';class TitlePage extends StatelessWidget { const TitlePage({Key? key, required this.title}) : super(key: key); final String title; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only( top: 15, bottom: 15, left: 30, ), child: Text( title, style: const TextStyle( fontSize: 28, fontWeight: FontWeight.bold, ), ), ); }}
1 change: 1 addition & 0 deletions lib/page_save/list_save.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/modules/book_module.dart';import 'package:book_store_app/page_description/book_info.dart';import 'package:book_store_app/page_main/list_book_layout.dart';import 'package:flutter/material.dart';import 'package:get/get.dart';class ListSave extends StatelessWidget { const ListSave({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Expanded( child: Obx(() { return Padding( padding: const EdgeInsets.only(left: 20), child: ListView( scrollDirection: Axis.vertical, shrinkWrap: true, children: BookModule.books .where((e) => e.isSaving.value) .map((e) => GestureDetector( onTap: () { Get.to(BookInfo(book: e)); }, child: ListBookLayout(book: e), )) .toList(), ), ); }), ); }}
1 change: 1 addition & 0 deletions lib/page_save/save_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'package:book_store_app/page_description/custom_appbar.dart';import 'package:book_store_app/page_main/title_page.dart';import 'package:flutter/material.dart';import '../page_main/navigation_buttons.dart';import 'list_save.dart';class SavePage extends StatelessWidget { const SavePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: const CustomAppBar(), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ TitlePage(title: 'Saved'), ListSave(), ], ), extendBody: true, bottomNavigationBar: const NavigationButton(), ); }}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -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:
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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: