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

ali haider #27

Open
wants to merge 3 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
233 changes: 226 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,238 @@

import 'package:book_store_app/page_1/card_1.dart';
import 'package:book_store_app/page_1/card_2.dart';
import 'package:book_store_app/page_1/card_3.dart';
import 'package:book_store_app/page_1/card_4.dart';
import 'package:book_store_app/page_1/card_5.dart';
import 'package:book_store_app/page_2/description.dart';
import 'package:book_store_app/page_2/rate_book.dart';
import 'package:book_store_app/page_3/card_1.dart';
import 'package:book_store_app/page_3/card_2.dart';
import 'package:book_store_app/page_3/card_3.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'modules.dart';
import 'my_text_field.dart';

void main() {
runApp(const MyApp());
runApp(const Home());
}

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

@override
Widget build(BuildContext context) {
return MaterialApp(
home:Scaffold(
appBar: AppBar(
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent
),
backgroundColor: const Color(0xfff0f0f0),
elevation: 0,
toolbarHeight: 10,
),
backgroundColor: const Color(0xfff0f0f0),

body: Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Card1(),
Padding(
padding: const EdgeInsets.only(top: 10, left: 20, right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Card2(),
const Card3(),
SingleChildScrollView(
child: Stack(
children: const [
Card4(),
Card5(),
],
),
)
],
),
)
]
),
),
),
);
}
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class Add extends StatelessWidget {
Add({Key? key}) : super(key: key);

static TextEditingController imageController = TextEditingController();
static TextEditingController descriptionController = TextEditingController();
static TextEditingController nameController = TextEditingController();
static TextEditingController authController = TextEditingController();
static TextEditingController priceController = TextEditingController();

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text("Book Store App"),

return MaterialApp(
home:Scaffold(
appBar: AppBar(
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent
),
backgroundColor: const Color(0xfff0f0f0),
elevation: 0,
toolbarHeight: 10,
),
backgroundColor: const Color(0xfff0f0f0),

body:Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const BackBar(),
const AddBook(),
MyTextField(myWidth: 320, myHeight: 50, lines: 1, hint: 'Book Name', suffixIcon: null, myController: nameController),
MyTextField(myWidth: 320, myHeight: 50, lines: 1, hint: 'Author Name', suffixIcon: null, myController: authController),
MyTextField(myWidth: 320, myHeight: 50, lines: 1, hint: 'Price', suffixIcon: null, myController: priceController),
MyTextField(myWidth: 320, myHeight: 50, lines: 1, hint: 'Image Link', suffixIcon: null, myController: imageController),
MyTextField(myWidth: 320, myHeight: 140, lines: 5, hint: 'Description', suffixIcon: null, myController: descriptionController),
const AddButton(),
const SizedBox(height: 50,)
],
),
)
),
);
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

@override
Widget build(BuildContext context) {
return MaterialApp(
home:Scaffold(
appBar: AppBar(
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent
),
backgroundColor: const Color(0xfff0f0f0),
elevation: 0,
toolbarHeight: 10,
),
backgroundColor: const Color(0xfff0f0f0),

body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BackBar(),
Padding(
padding: const EdgeInsets.only(left: 30, right: 30, top: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Cart', style: TextStyle(
fontSize: 24,
height: 2,
fontWeight: FontWeight.bold
),),SizedBox(height: 15,),
Stack(
children: [
Container(
color: const Color(0xfff0f0f0),
width: double.maxFinite,
height: 622,
child: Expanded(
child: ListView(
children: MyBooks.book.where((element) => element.condition.value == true).map((e) => Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 35),
child: Image.network(e.imageLink,
width: 80, height: 130,),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(e.bookName, style: const TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold),),
Text(e.bookAuth, style: const TextStyle(color: Colors.black87, fontSize: 12,height: 2),),
Text(e.price, style: const TextStyle(color: Colors.black, fontSize: 20,height: 2),),
const Stars(),
],
)
],
),
),).toList()
),
),
),
Card5(),
],
)
],
),
)
],
)
),
);
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class BookDetails extends StatelessWidget {

final MyBooks myBook;
const BookDetails({Key? key, required this.myBook}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
home:Scaffold(
appBar: AppBar(
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent
),
backgroundColor: const Color(0xfff0f0f0),
elevation: 0,
toolbarHeight: 0,
),
backgroundColor: const Color(0xfff0f0f0),

body: Column(
children: [
const BackBar(),const SizedBox(height: 15,),
Image.network(myBook.imageLink, width: 216, height: 320,),
MyText(text: myBook.bookName, color: Colors.black, size: 24, height: 2,),
MyText(text: myBook.bookAuth, color: Colors.black54, size: 14, height: 2,),
const Rate(),
Description(myBook: myBook),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: const [
ContainerButton(width: 154, height: 40, textColor: Colors.black, containerColor: Colors.white, icon: Icons.preview, text: ' Preview',),
ContainerButton(width: 154, height: 40, textColor: Colors.black, containerColor: Colors.white, icon: Icons.reviews_outlined, text: ' Reviews',),
],
),const SizedBox(height: 18,),
const ContainerButton(width: 319, height: 50, textColor: Colors.white, containerColor: Colors.black,
icon: null, text: r' Buy Now For $49.99',),
],
)
),
);
}
Expand Down
136 changes: 136 additions & 0 deletions lib/modules.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@

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

class MyBooks {

static Rx<IconData> selectedIcon = Icons.home_filled.obs;
final RxBool condition = false.obs;
final String imageLink;
final String bookName;
final String bookAuth;
final String price;
final String description;

MyBooks({required this.imageLink, required this.bookName, required this.bookAuth, required this.price, required this.description, });

static List<MyBooks> book = [
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\ngood book\ngood book\ngood book\ngood book\ngood book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood2', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood3', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood4', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood5', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood6', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood7', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
MyBooks(imageLink: 'https://i.harperapps.com/hcanz/covers/9780008563790/x293.jpg', bookName: 'fire and blood8', bookAuth: 'George RR Martin', price: r'$49.99', description: 'good book\ngood book\ngood book\n'),
];

buy(){
condition.value = true;
}

}

class Navigation {
final IconData icon;

Navigation({required this.icon});

static List<Navigation> icons = [
Navigation(icon: Icons.home_filled),
Navigation(icon: Icons.shopping_cart),
Navigation(icon: Icons.add),
];
}


class MyText extends StatelessWidget {

final String text;
final Color color;
final double size;
final double height;

const MyText({
Key? key, required this.text, required this.color, required this.size, required this.height
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Text(text, style: TextStyle(
height: height,
color: color,
fontSize: size,
),);
}
}


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

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(Icons.star, color: Color(0xffFFC41F),), Icon(Icons.star, color: Color(0xffFFC41F),), Icon(Icons.star, color: Color(0xffFFC41F),),
Icon(Icons.star, color: Color(0xffFFC41F),), Icon(Icons.star_border_sharp, color: Color(0xffFFC41F),),
],
);
}
}



class ContainerButton extends StatelessWidget {

final double width;
final double height;
final Color textColor;
final Color containerColor;
final IconData? icon;
final String text;

const ContainerButton({
Key? key, required this.width, required this.height, required this.textColor, required this.containerColor, required this.icon, required this.text,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8),
child: TextButton(
onPressed: (){
if(icon == null){

}
},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
),
child: Container(
width: width,
height: height,
decoration: BoxDecoration(
color: containerColor,
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color: Colors.black,),
Text(text, style: TextStyle(
color: textColor,
fontSize: 16,
),),
],
),
)
),
);
}
}

Loading