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

Fanar Khalil #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file added assets/images/picscreen1.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions lib/Info_book/Buy_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../bookmodel.dart';

class Buybutton extends StatelessWidget {
const Buybutton({Key? key, required this.book}): super(key: key);
final Book book;
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: () {
Book.cart.add(book);
Navigator.pop(context);
},
child: Container(
width: 335,
height: 60,
margin: const EdgeInsets.symmetric(vertical: 20),
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black),
child: Text(
'Buy Now for ${book.price}',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
);
}
}
80 changes: 80 additions & 0 deletions lib/Info_book/Info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import 'package:book_store_app/bookmodel.dart';
import 'package:flutter/material.dart';

class Info extends StatelessWidget {
const Info({
Key? key,
required this.book,
}) : super(key: key);

final Book book;

@override
Widget build(BuildContext context) {
return Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.book_name,
style: const TextStyle(
fontSize: 26,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.author,
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.normal,
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: const [
Padding(
padding: EdgeInsets.only(right: 2),
child: Icon(Icons.star, size: 16, color: Colors.orange),
),
Icon(Icons.star, size: 16, color: Colors.orange),
Icon(Icons.star, size: 16, color: Colors.orange),
Icon(Icons.star, size: 16, color: Colors.grey),
Padding(
padding: EdgeInsets.symmetric(horizontal: 5),
child: Text(
'4.0/5.0',
style: TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
)
]),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.description,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.normal,
),
),
),
],
),
);
}
}
47 changes: 47 additions & 0 deletions lib/Info_book/InfoButtons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'package:flutter/material.dart';

class InfoButton extends StatelessWidget {
const InfoButton({
Key? key,
required this.icon,
required this.text,
}) : super(key: key);

final IconData icon;
final String text;
@override
Widget build(BuildContext context) {
return Container(
width: 154,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white),
child: Align(
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
size: 24,
color: Colors.black,
),
const SizedBox(
width: 8,
),
Text(
text,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black),
)
],
),
),
);
}
}
/*
*/
49 changes: 49 additions & 0 deletions lib/Info_book/Info_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:book_store_app/Info_book/InfoButtons.dart';
import 'package:book_store_app/Info_book/Info.dart';
import 'package:book_store_app/Info_book/book_image.dart';
import 'package:book_store_app/bookmodel.dart';
import 'package:flutter/material.dart';
import '../add_book_page/app_bar_addpage.dart';
import 'Buy_button.dart';

class Infopage extends StatelessWidget {
const Infopage({Key? key, required this.book}) : super(key: key);

final Book book;

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: const Color.fromARGB(255, 245, 245, 245),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const AppBaradd(),
MyBookImage(book: book),
Info(book: book),

Stack(children: [
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
InfoButton(icon: Icons.menu_outlined, text: 'Preview'),
InfoButton(icon: Icons.comment_outlined, text: 'Reviews')
],
),
Buybutton(book:book,),
],
)
])
],
),
),
),
);
}
}
26 changes: 26 additions & 0 deletions lib/Info_book/book_image.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:book_store_app/bookmodel.dart';
import 'package:flutter/material.dart';

class MyBookImage extends StatelessWidget {
const MyBookImage({
Key? key,
required this.book,
}) : super(key: key);

final Book book;

@override
Widget build(BuildContext context) {
return Expanded(
flex: 5,
child: Container(
margin: const EdgeInsets.symmetric(vertical: 20),
width: 250,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(book.image_link.toString()),fit: BoxFit.cover),
borderRadius: BorderRadius.circular(10)),
),
);
}
}
50 changes: 50 additions & 0 deletions lib/Main_page/Search.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class Search extends StatelessWidget {
const Search({
Key? key,
required this.SearchController,
required this.typed,
}) : super(key: key);

final TextEditingController SearchController;
final RxString typed;

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: TextField(
controller: SearchController,
onChanged: (x) {
typed.value = x;
},
style: const TextStyle(fontSize: 20),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: 'Search .....',
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide.none,
),
suffixIcon: TextButton(
child: Obx(() {
return Icon(
Icons.search_rounded,
color: typed.isEmpty ? Colors.grey : Colors.blue,
size: 30,
);
}),
onPressed: () {},
),
),
),
);
}
}
33 changes: 33 additions & 0 deletions lib/Main_page/appbar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';

class MYAppBar extends StatelessWidget {
const MYAppBar({
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: const EdgeInsets.only(right: 10),
width: 40,
height: 40,
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('assets/images/picscreen1.1.jpg'), fit: BoxFit.cover),
borderRadius: BorderRadius.circular(10)),
),
const Expanded(
child: Text(
'Hi,Fanar!',
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black),
),
),
const Icon(Icons.more_vert, size: 24, color: Colors.black)
],
);
}
}
51 changes: 51 additions & 0 deletions lib/Main_page/button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:book_store_app/Main_page/mainpage.dart';
import 'package:flutter/material.dart';
import '../add_book_page/add_book_page.dart';
import '../cart_page/cart_page.dart';
import 'icon_button.dart';

class Button extends StatelessWidget {
const Button({
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return FloatingActionButton(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
TextButton(
onPressed: () {
Navigator.push(context,MaterialPageRoute(builder: (context) => const MainPage()));
},
child: const MyIcons(icon: Icons.home)),
TextButton(
onPressed: () {
Navigator.push(context,MaterialPageRoute(builder: (context) => const CartPage()));
},
child: const MyIcons(icon: Icons.shopping_cart_outlined)),
TextButton(
onPressed: () {
Navigator.push(context,MaterialPageRoute(builder: (context) => const AddBook()));
},
child: const MyIcons(icon: Icons.add)),
]),
onPressed: () {},
);
}
}











Loading