Skip to content

Instantly share code, notes, and snippets.

@perymerdeka
Created October 24, 2021 17:09
Show Gist options
  • Save perymerdeka/199b35ff16d0af3298fb66388953bcbe to your computer and use it in GitHub Desktop.
Save perymerdeka/199b35ff16d0af3298fb66388953bcbe to your computer and use it in GitHub Desktop.
Base Project Structure
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:providers/providers/products.dart';
import './screens/products_overview_screen.dart';
import './screens/product_detail_screen.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (BuildContext context) => ProductProvider(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'MyShop',
theme: ThemeData(
fontFamily: 'Lato',
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.indigo)
.copyWith(secondary: Colors.amber),
),
home: const ProductsOverviewScreen(),
routes: {
ProductDetailScreen.routeName: (ctx) => const ProductDetailScreen(),
},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment