Advertisement
Genral

Untitled

Feb 11th, 2024
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.29 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() {
  4.   runApp(MyStoreApp());
  5. }
  6.  
  7. class MyStoreApp extends StatelessWidget {
  8.   @override
  9.   Widget build(BuildContext context) {
  10.     return MaterialApp(
  11.       title: 'My Store',
  12.       theme: ThemeData(
  13.         primarySwatch: Colors.blue,
  14.       ),
  15.       home: MyHomePage(),
  16.     );
  17.   }
  18. }
  19.  
  20. class MyHomePage extends StatefulWidget {
  21.   @override
  22.   _MyHomePageState createState() => _MyHomePageState();
  23. }
  24.  
  25. class _MyHomePageState extends State<MyHomePage> {
  26.   @override
  27.   Widget build(BuildContext context) {
  28.     return Scaffold(
  29.       appBar: AppBar(
  30.         title: Text('My Store'),
  31.       ),
  32.       body: Column(
  33.         children: [
  34.           // Add your categories and products here as widgets
  35.           // For example:
  36.           // Category(title: 'Apparel'),
  37.           // Product(title: 'Ankle Boots', price: 49.99),
  38.         ],
  39.       ),
  40.       bottomNavigationBar: BottomAppBar(
  41.         shape: CircularNotchedRectangle(),
  42.         child: Row(
  43.           mainAxisAlignment: MainAxisAlignment.spaceBetween,
  44.           children: [
  45.             IconButton(icon: Icon(Icons.search), onPressed: () {}),
  46.             IconButton(icon: Icon(Icons.shopping_cart), onPressed: () {}),
  47.             IconButton(icon: Icon(Icons.person), onPressed: () {}),
  48.           ],
  49.         ),
  50.       ),
  51.       floatingActionButton: FloatingActionButton(
  52.         onPressed: () {},
  53.         tooltip: 'Add to cart',
  54.         child: Icon(Icons.add),
  55.       ),
  56.     );
  57.   }
  58. }
  59.  
  60. class Category extends StatelessWidget {
  61.   final String title;
  62.  
  63.   const Category({Key key, this.title}) : super(key: key);
  64.  
  65.   @override
  66.   Widget build(BuildContext context) {
  67.     return Padding(
  68.       padding: const EdgeInsets.all(8.0),
  69.       child: Text(title),
  70.     );
  71.   }
  72. }
  73.  
  74. class Product extends StatelessWidget {
  75.   final String title;
  76.   final double price;
  77.  
  78.   const Product({Key key, this.title, this.price}) : super(key: key);
  79.  
  80.   @override
  81.   Widget build(BuildContext context) {
  82.     return Card(
  83.       child: Padding(
  84.         padding: const EdgeInsets.all(8.0),
  85.         child: Column(
  86.           crossAxisAlignment: CrossAxisAlignment.stretch,
  87.           children: [
  88.             Text(title),
  89.             Text('\$$price'),
  90.           ],
  91.         ),
  92.       ),
  93.     );
  94.   }
  95. }
  96.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement