Skip to content

Instantly share code, notes, and snippets.

View rohan20's full-sized avatar

Rohan Taneja rohan20

View GitHub Profile
@rohan20
rohan20 / product_detail_page
Created July 27, 2018 10:07
ProductDetailPage (Static)
import 'package:flutter/material.dart';
class ProductDetailPage extends StatefulWidget {
@override
_ProductDetailPageState createState() => _ProductDetailPageState();
}
class _ProductDetailPageState extends State<ProductDetailPage>
with TickerProviderStateMixin {
@override
@rohan20
rohan20 / product_list_page
Created July 30, 2018 06:56
ProductListPage (static)
import 'package:flutter/material.dart';
import 'package:products_tutorial/widgets/products_list_item.dart';
class ProductsListPage extends StatelessWidget {
BuildContext context;
@override
Widget build(BuildContext context) {
this.context = context;
@rohan20
rohan20 / main.dart
Created August 6, 2018 06:51
E-Commerce app using Flutter - Part 1: The User Interface
import 'package:flutter/material.dart';
import 'package:products_tutorial/pages/products_list_page.dart';
import 'package:products_tutorial/util/routes.dart';
void main() {
runApp(
MaterialApp(
home: ProductsListPage(),
routes: Routes.routes,
),
);
@rohan20
rohan20 / product_list_page.dart
Last active August 6, 2018 06:57
E-Commerce app using Flutter - Part 1: The User Interface
@override
Widget build(BuildContext context) {
this.context = context;
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.white,
title: Text(
"PRODUCT LIST",
@rohan20
rohan20 / product_list_page.dart
Created August 6, 2018 06:58
E-Commerce app using Flutter - Part 1: The User Interface
_buildProductsListPage() {
Size screenSize = MediaQuery.of(context).size;
return Container(
color: Colors.grey[100],
child: ListView.builder(
itemCount: 5,
itemBuilder: (context, index) {
if (index == 0) {
return _buildFilterWidgets(screenSize);
} else if (index == 4) {
@rohan20
rohan20 / product_list_item.dart
Created August 6, 2018 06:59
E-Commerce app using Flutter - Part 1: The User Interface
const ProductsListItem({Key key,
this.name,
this.currentPrice,
this.originalPrice,
this.discount,
this.imageUrl})
: super(key: key);
@rohan20
rohan20 / product_list_item.dart
Created August 6, 2018 07:00
E-Commerce app using Flutter - Part 1: The User Interface
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildProductItemCard(context),
_buildProductItemCard(context),
],
);
@rohan20
rohan20 / product_detail_page.dart
Created August 6, 2018 07:01
E-Commerce app using Flutter - Part 1: The User Interface
class _ProductDetailPageState extends State<ProductDetailPage>
with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
leading: IconButton(
icon: Icon(
Icons.chevron_left,
@rohan20
rohan20 / product_detail_page.dart
Created August 6, 2018 07:01
E-Commerce app using Flutter - Part 1: The User Interface
_buildProductDetailsPage(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
return ListView(
children: <Widget>[
Container(
padding: const EdgeInsets.all(4.0),
child: Card(
elevation: 4.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@rohan20
rohan20 / product_list_item.dart
Created August 6, 2018 07:02
E-Commerce app using Flutter - Part 1: The User Interface
_buildProductImagesWidgets() {
TabController imagesController = TabController(length: 3, vsync: this);
return Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
height: 250.0,
child: Center(
child: DefaultTabController(
length: 3,
child: Stack(