diff --git a/assets/Rectangle14.png b/assets/Rectangle14.png new file mode 100644 index 0000000..d48c9f1 Binary files /dev/null and b/assets/Rectangle14.png differ diff --git a/assets/Vector.png b/assets/Vector.png new file mode 100644 index 0000000..0967b60 Binary files /dev/null and b/assets/Vector.png differ diff --git a/assets/Vector1.png b/assets/Vector1.png new file mode 100644 index 0000000..6ff15c0 Binary files /dev/null and b/assets/Vector1.png differ diff --git a/assets/Vector2.png b/assets/Vector2.png new file mode 100644 index 0000000..bc30078 Binary files /dev/null and b/assets/Vector2.png differ diff --git a/assets/Vector3.png b/assets/Vector3.png new file mode 100644 index 0000000..53b2d9a Binary files /dev/null and b/assets/Vector3.png differ diff --git a/assets/Vector4.png b/assets/Vector4.png new file mode 100644 index 0000000..3473b4c Binary files /dev/null and b/assets/Vector4.png differ diff --git a/assets/download.jpg b/assets/download.jpg new file mode 100644 index 0000000..679b96f Binary files /dev/null and b/assets/download.jpg differ diff --git a/assets/image16.png b/assets/image16.png new file mode 100644 index 0000000..e86f819 Binary files /dev/null and b/assets/image16.png differ diff --git a/assets/image17.png b/assets/image17.png new file mode 100644 index 0000000..007a4ce Binary files /dev/null and b/assets/image17.png differ diff --git a/assets/images1.jpg b/assets/images1.jpg new file mode 100644 index 0000000..393a595 Binary files /dev/null and b/assets/images1.jpg differ diff --git a/assets/images2.jpg b/assets/images2.jpg new file mode 100644 index 0000000..16f6999 Binary files /dev/null and b/assets/images2.jpg differ diff --git a/lib/add_book.dart b/lib/add_book.dart new file mode 100644 index 0000000..c35dc45 --- /dev/null +++ b/lib/add_book.dart @@ -0,0 +1,147 @@ + +import 'package:flutter/material.dart'; +// ignore: depend_on_referenced_packages +import 'package:get/get.dart'; + +import 'modle.dart'; + +class AddBook extends StatefulWidget { + const AddBook({Key? key}) : super(key: key); + + @override + State createState() => _AddBookState(); +} + +class _AddBookState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Padding( + padding: const EdgeInsets.only(right: 20, left: 20, top: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: + Icon(Icons.arrow_back_ios, size: 15, color: Colors.black), + ), + Icon(Icons.more_vert, color: Colors.black), + ], + ), + const SizedBox( + height: 15, + ), + const Text( + 'Add Book ', + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 45, + ), + TextField( + controller: Field.myController1, + textInputAction: TextInputAction.next, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + hintText: 'Book Name', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + )), + ), + const SizedBox( + height: 15, + ), + TextField( + controller: Field.myController2, + textInputAction: TextInputAction.next, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + hintText: 'Author Name', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + )), + ), + const SizedBox( + height: 15, + ), + TextField( + controller: Field.myController3, + textInputAction: TextInputAction.next, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + hintText: 'Price', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + )), + ), + const SizedBox( + height: 15, + ), + TextField( + controller: Field.myController4, + textInputAction: TextInputAction.next, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + hintText: 'Image link', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + )), + ), + const SizedBox( + height: 15, + ), + TextField( + controller: Field.myController5, + textInputAction: TextInputAction.send, + style: const TextStyle( + fontSize: 25.0, height: 0, color: Colors.black), + decoration: InputDecoration( + contentPadding: EdgeInsets.all(50), + filled: true, + fillColor: Colors.white, + hintText: 'Description', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15), + borderSide: BorderSide.none, + )), + ), + const SizedBox( + height: 15, + ), + TextButton( + onPressed: () { + Field.new_books(); + }, + child: Container( + width: 300, + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.black, + borderRadius: BorderRadius.circular(15)), + child: const Text( + ' Add', + style: TextStyle(color: Colors.white), + textAlign: TextAlign.center, + )), + ), + ], + ), + ), + ); + } +} diff --git a/lib/card.dart b/lib/card.dart new file mode 100644 index 0000000..ffdfbc9 --- /dev/null +++ b/lib/card.dart @@ -0,0 +1,55 @@ + + +import 'package:book_store_app/modle.dart'; +import 'package:flutter/material.dart'; + +import 'mybook.dart'; + +class MyCart extends StatelessWidget { + const MyCart({Key? key}) : super(key: key); + @override + Widget build(BuildContext context) { + return Scaffold( + + + body: Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 10), + child: TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Icon(Icons.arrow_back_ios_new,size: 15, color: Colors.black)), + ), + const Padding( + padding: EdgeInsets.all(10), + child: Icon(Icons.more_vert,size: 15, color: Colors.black),) + ], + ), + + Center( + child: Padding( + padding: const EdgeInsets.all(35), + child: Stack(children: [ + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + const Text('Cart', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600)), + + SizedBox(height: 40), + Column( + children: data_book.datas + .where((e) => !e.isDone.value) + .map((e) => mybook(item: e, context: context)) + .toList(), + ), + ]), + ]), + )), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index bcc58f7..f6eb00a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,10 @@ + import 'package:flutter/material.dart'; +import 'add_book.dart'; +import 'main.dart'; +import 'page_1.dart'; + void main() { runApp(const MyApp()); } @@ -9,12 +14,30 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp( - home: Scaffold( - body: Center( - child: Text("Book Store App"), - ), + return MaterialApp( + title: 'Flutter Demo', + debugShowCheckedModeBanner: false, + theme: ThemeData( + primarySwatch: Colors.blue, + //backgroundColor: Color(0xffE5E5E5), ), + home: const MyHomePage(), + ); + } +} + +class MyHomePage extends StatelessWidget { + const MyHomePage({ + Key? key, + }) : super(key: key); + + + + + Widget build(BuildContext context) { + return const Scaffold( + body:Page_1() , ); } } + diff --git a/lib/modle.dart b/lib/modle.dart new file mode 100644 index 0000000..5924328 --- /dev/null +++ b/lib/modle.dart @@ -0,0 +1,80 @@ +import 'dart:ffi'; + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class data_book { + final String image; + final String title; + final String decration; + final String price; + final IconData icon; + final RxBool isDone = false.obs; + data_book( + this.image, + this.title, + this.decration, + this.price, + this.icon, + ); + + static RxList datas = [ + data_book( + 'https://dl.airtable.com/.attachments/b82bca4b5496e87ae2037da38a507265/1afe35bf/cover.jpg?ts=1661017804&userId=usrCBA8uInu6jO3n2&cs=ea7f6e9447680e9e', + 'Yves Saint Laurent', + 'hfjdj ', + '\$99.99', + Icons.star), + data_book('https://images.randomhouse.com/cover/9780440000624', + 'Yves Saint Laurent', 'SMenkesuzy ', '\$99.99', Icons.star), + data_book('https://images.randomhouse.com/cover/9780756416058', + 'Yves Saint Laurent', 'SMenkesuzy ', '\$99.99', Icons.star), + data_book('https://images.randomhouse.com/cover/9781984805638', + 'Yves Saint Laurent', 'SMenkesuzy ', '\$99.99', Icons.star) + ].obs; + markAsDone(){ + isDone.value = true; + } + +} + + +class add_book { + final String title; + final String Author_Name; + final String Price; + final String image; + final String dec; + add_book( + {required this.title, + // ignore: non_constant_identifier_names + required this.Author_Name, + required this.Price, + required this.image, + required this.dec}); + + static RxList notes = [].obs; + static RxString queue = ''.obs; +} + +class Field { + static TextEditingController myController1 = TextEditingController(); + static TextEditingController myController2 = TextEditingController(); + static TextEditingController myController3 = TextEditingController(); + static TextEditingController myController4 = TextEditingController(); + static TextEditingController myController5 = TextEditingController(); + + static void new_books(){ + add_book.notes.add(add_book( + title: Field.myController1.text, + Author_Name: Field.myController2.text, + Price: Field.myController3.text, + image: Field.myController4.text, + dec: Field.myController5.text)); + Field.myController1.clear(); + Field.myController2.clear(); + Field.myController3.clear(); + Field.myController5.clear(); + Field.myController4.clear(); + } +} diff --git a/lib/mybook.dart b/lib/mybook.dart new file mode 100644 index 0000000..9617cfc --- /dev/null +++ b/lib/mybook.dart @@ -0,0 +1,78 @@ +import 'package:book_store_app/view_book.dart'; + +import 'package:flutter/material.dart'; + +import 'modle.dart'; + +Widget mybook({required BuildContext context, required data_book item}) => + Row(children: [ + TextButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) =>InformationBook(item: item,))), + child: Image.network( + item.image, + width: 75, + height: 100, + )), + Padding( + padding: const EdgeInsets.only(left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox( + height: 0, + ), + Text( + item.title, + style: const TextStyle(color: Colors.black, fontSize: 15), + ), + const SizedBox( + height: 16, + ), + Text(item.decration, + style: const TextStyle( + color: Color.fromARGB(255, 113, 110, 110), fontSize: 10)), + const SizedBox( + height: 16, + ), + Text(item.price, + style: const TextStyle(color: Colors.black, fontSize: 10)), + const SizedBox( + height: 16, + ), + // ignore: prefer_const_literals_to_create_immutables + Row( + children: [ + Icon( + item.icon, + color: const Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: const Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: const Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: const Color.fromARGB(255, 242, 242, 240), + size: 10, + ), + ], + ) + ], + ), + ) + ]); diff --git a/lib/newbook.dart b/lib/newbook.dart new file mode 100644 index 0000000..ec1f4ea --- /dev/null +++ b/lib/newbook.dart @@ -0,0 +1,76 @@ +import 'package:book_store_app/modle.dart'; +import 'package:flutter/material.dart'; + + +import 'package:get/get.dart'; + +class NewBook extends StatefulWidget { + const NewBook({Key? key}) : super(key: key); + + @override + State createState() => _NewBookState(); +} + +class _NewBookState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Expanded( + child: Obx(() { + + return ListView( + children: add_book.notes + .map((e) => Row(children: [ + TextButton( + onPressed: () {}, + child: Image.network( + e.image, + width: 75, + height: 100, + )), + Padding( + padding: const EdgeInsets.only(left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox( + height: 0, + ), + Text( + e.Author_Name, + style: const TextStyle( + color: Colors.black, fontSize: 15), + ), + const SizedBox( + height: 16, + ), + Text(e.title, + style: const TextStyle( + color: Color.fromARGB(255, 113, 110, 110), + fontSize: 10)), + const SizedBox( + height: 16, + ), + Text(e.Price, + style: const TextStyle( + color: Colors.black, fontSize: 10)), + const SizedBox( + height: 16, + ), + // ignore: prefer_const_literals_to_create_immutables + Text(e.dec, + style: const TextStyle( + color: Colors.black, fontSize: 10)), + const SizedBox( + height: 16, + ), + ], + ), + ) + ])) + .toList()); + }), + ), + ); + } +} diff --git a/lib/page_1.dart b/lib/page_1.dart new file mode 100644 index 0000000..bef33ec --- /dev/null +++ b/lib/page_1.dart @@ -0,0 +1,112 @@ + + + +import 'package:book_store_app/modle.dart'; +import 'package:flutter/material.dart'; + +import 'add_book.dart'; +import 'card.dart'; +import 'mybook.dart'; +import 'package:get/get.dart'; + +import 'newbook.dart'; + +class Page_1 extends StatelessWidget { + const Page_1({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + + TextEditingController myController11 = TextEditingController(); + return Scaffold( + body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 15), + child: + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Image.asset('Rectangle14.png'), + Transform.translate( + offset: const Offset(-65, 0), + child: const Text( + 'Hi, Hassan!', + style: TextStyle(fontWeight: FontWeight.w600), + )), + const Icon(Icons.more_vert, color: Colors.black), + ]), + ), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: TextField( + minLines: 1, + controller: myController11, + + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + suffixIcon: const Icon(Icons.search), + hintText: 'Search', + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(20), + borderSide: BorderSide.none, + )), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 20, left: 15), + child: Text( + 'Book List', + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + ), + Stack(children: [ + Expanded( + child: Container( + padding: const EdgeInsets.only(top: 20, left: 15, right: 15), + height: 500, + child: ListView( + children: data_book.datas + + .map((e) => mybook(item: e, context: context)) + .toList(), + )), + ), + Transform.translate( + offset: const Offset(75, 400), + child: Container( + width: 175, + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(10)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + TextButton( + onPressed: () {}, + child: Image.asset('Vector4.png'), + ), + TextButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const MyCart())), + child: Image.asset('Vector3.png'), + ), + TextButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AddBook())), + child: Image.asset('Vector2.png'), + ) + ]), + ), + ) + ]), + ])); + } +} + + + + diff --git a/lib/view_book.dart b/lib/view_book.dart new file mode 100644 index 0000000..6381439 --- /dev/null +++ b/lib/view_book.dart @@ -0,0 +1,152 @@ +// TODO Implement this library. +import 'package:flutter/material.dart'; + +import 'modle.dart'; + +class InformationBook extends StatelessWidget { + final data_book item; + const InformationBook({ + Key? key, + required this.item, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Padding( + padding: const EdgeInsets.only(right: 20, left: 20, top: 20), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: ()=>Navigator.pop(context), + child: const Icon( + Icons.arrow_back_ios, + size: 15,color: Colors.black + ), + ), + Icon(Icons.more_vert, color: Colors.black) + ], + ), + const SizedBox( + height: 20, + ), + Image.network( + item.image, + height: 300, + width: 200, + fit: BoxFit.fitHeight, + ), + const SizedBox( + height: 15, + ), + Text( + item.title, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + Text( + item.decration, + style: + TextStyle(fontSize: 10, color: Color.fromARGB(66, 46, 43, 43)), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + item.icon, + color: Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: Color.fromARGB(255, 230, 230, 82), + size: 10, + ), + Icon( + item.icon, + color: Color.fromARGB(255, 242, 242, 240), + size: 10, + ), + const Text( + '4.5/5.0', + style: TextStyle(fontSize: 10), + ) + ], + ), + const SizedBox( + height: 12, + ), + const 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(fontSize: 14), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: 130, + height: 35, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(5)), + child: + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Image.asset( + 'Vector.png', + ), + SizedBox( + width: 7, + ), + Text('Preview') + ]), + ), + Container( + width: 130, + height: 35, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(5)), + child: + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Image.asset( + 'Vector1.png', + ), + SizedBox( + width: 7, + ), + Text('Previews') + ]), + ) + ], + ), + SizedBox( + height: 15, + ), + Container( + width: 300, + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.black, borderRadius: BorderRadius.circular(15)), + child: Text( + 'Buy Now for ${item.price}', + style: TextStyle(color: Colors.white), + textAlign: TextAlign.center, + )) + ], + ), + )); + } +} diff --git a/pubspec.lock b/pubspec.lock index 7bc8bdd..62f34da 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: diff --git a/pubspec.yaml b/pubspec.yaml index cd0f457..6eeae83 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: ^4.6.5 dev_dependencies: flutter_test: @@ -58,9 +59,18 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - Rectangle14.png + - image16.png + - Vector.png + - Vector1.png + - images1.jpg + - images2.jpg + - image17.png + - download.jpg + - Vector2.png + - Vector3.png + - Vector4.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware