Skip to content

Commit

Permalink
added screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Eznira committed Aug 17, 2024
1 parent 9b7fd6d commit ca9a8db
Show file tree
Hide file tree
Showing 21 changed files with 483 additions and 92 deletions.
Binary file removed assets/images/image1.png
Binary file not shown.
Binary file removed assets/images/image2.jpg
Binary file not shown.
Binary file added assets/images/nike_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/shoe_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/shoe_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/shoe_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/shoe_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/shopping_cart.png
Binary file not shown.
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
12 changes: 9 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import 'package:flutter/material.dart';
import 'package:minimal_e_shop/screens/intro.dart';
import 'package:provider/provider.dart';

import 'screens/home.dart';
import 'models/shoe_data.dart';

void main() {
runApp(const MyApp());
runApp(
ChangeNotifierProvider(
create: (context) => ShoeData(), child: const MyApp()),
);
}

class MyApp extends StatelessWidget {
Expand All @@ -14,11 +19,12 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.purple),
useMaterial3: true,
),
home: const MyHomePage(),
home: IntroPage(),
);
}
}
85 changes: 0 additions & 85 deletions lib/models/bag.dart

This file was deleted.

65 changes: 65 additions & 0 deletions lib/models/shoe_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'package:flutter/cupertino.dart';

import 'shoe_model.dart';

class ShoeData extends ChangeNotifier {
late final show_list = [shoe1, shoe2, shoe3, shoe4];

final cart_list = [];



final shoe1 = Shoe(
name: "Classic Leather Sneakers",
description:
"Timeless leather sneakers with a comfortable fit. Perfect for casual wear, offering a blend of style and durability.",
rating: 4.7,
boughtInPastMonth: 75,
price: 79.99, discount: 5,
deliveryDate: DateTime(2024, 9, 5),
deliveryLocation: "Lagos, Nigeria",
imagePath: "assets/images/shoe_1.jpg", // Example image path
);

final shoe2 = Shoe(
name: "Running Shoes",
description:
"Lightweight and breathable running shoes designed for performance. Features cushioning and support for a comfortable run.",
rating: 4.6,
boughtInPastMonth: 60,
price: 99.99,
discount: 10,
deliveryDate: DateTime(2024, 9, 5),
deliveryLocation: "Abuja, Nigeria",
imagePath: "assets/images/shoe_2.jpg", // Example image path
);

// ... (similarly create more shoe objects)

final shoe3 = Shoe(
name: "Hiking Boots",
description:
"Durable hiking boots with ankle support and a rugged outsole. Ideal for outdoor adventures and challenging terrains.",
rating: 4.8,
boughtInPastMonth: 40,
price: 129.99,
discount: 15,
deliveryDate: DateTime(2024, 9, 5),
deliveryLocation: "Port Harcourt, Nigeria",
imagePath: "assets/images/shoe_3.jpg", // Example image path
);

final shoe4 = Shoe(
name: "Stylish Sandals",
description:
"Comfortable and fashionable sandals perfect for warm weather. Available in various colors and designs.",
rating: 4.5,
boughtInPastMonth: 80,
price: 49.99,
discount: 5,
deliveryDate: DateTime(2024, 9, 5),
deliveryLocation: "Kano, Nigeria",
imagePath: "assets/images/shoe_4.jpg", // Example image path
);
}

23 changes: 23 additions & 0 deletions lib/models/shoe_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Shoe {
final String name;
final String description;
final double rating;
final int boughtInPastMonth;
final double price;
final double discount;
final DateTime deliveryDate;
final String deliveryLocation;
final String imagePath; // Added image path field

Shoe({
required this.name,
required this.description,
required this.rating,
required this.boughtInPastMonth,
required this.price,
required this.discount,
required this.deliveryDate,
required this.deliveryLocation,
required this.imagePath,
});
}
71 changes: 67 additions & 4 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'package:flutter/material.dart';
import 'package:minimal_e_shop/screens/page1.dart';
import 'package:minimal_e_shop/screens/page2.dart';
import 'package:minimal_e_shop/utils/custom_nav_bar.dart';

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
Expand All @@ -8,13 +11,73 @@ class MyHomePage extends StatefulWidget {
}

class _MyHomePageState extends State<MyHomePage> {
int selectedIndex = 0;
List<Widget> _pages = [Page1(), Page2()];

void navigatePage(int index) {
setState(() {
selectedIndex = index;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Image.asset("assets/images/shopping_cart.png"),
],
backgroundColor: Colors.grey[300],
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: Builder(builder: (context) {
return IconButton(
icon: Icon(Icons.menu),
onPressed: () => Scaffold.of(context).openDrawer(),
);
}),
),
body: _pages[selectedIndex],
bottomNavigationBar: CustomNavBar(onTabChange: navigatePage),
drawer: Drawer(
backgroundColor: Colors.grey[900],
child: Column(
children: [
DrawerHeader(
child: Image.asset(
'assets/images/nike_logo.png',
color: Colors.white,
)),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 6),
child: ListTile(
leading: Icon(
Icons.home,
color: Colors.white,
),
title: Text(
'Home',
style: TextStyle(color: Colors.white),
))),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 6),
child: ListTile(
leading: Icon(
Icons.card_travel,
color: Colors.white,
),
title: Text('Cart', style: TextStyle(color: Colors.white)),
),
),
const Spacer(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 6),
child: ListTile(
leading: Icon(
Icons.exit_to_app,
color: Colors.white,
),
title: Text('Exit', style: TextStyle(color: Colors.white)),
),
)
],
),
),
);
}
Expand Down
72 changes: 72 additions & 0 deletions lib/screens/intro.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:minimal_e_shop/screens/home.dart';

class IntroPage extends StatelessWidget {
const IntroPage({super.key});

void ontap(BuildContext context) => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyHomePage(),
));
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
),
body: Column(
children: [
const Spacer(),
Center(
child: Image.asset(
'assets/images/nike_logo.png',
color: Colors.grey[800],
),
),
const Spacer(),
Text(
"Just do it!",
style: TextStyle(
color: Colors.grey[800],
fontSize: 20,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
"packages have newer versions"
" incompatible with dependency constraints.",
style: TextStyle(color: Colors.grey[500]),
textAlign: TextAlign.center,
),
),
const SizedBox(
height: 30,
),
GestureDetector(
onTap: () => ontap(context),
child: Container(
height: 60,
margin: const EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey[800],
),
child: const Center(
child: Text(
"Shop Now",
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
),
),
),
const Spacer(),
],
),
);
}
}
Loading

0 comments on commit ca9a8db

Please sign in to comment.