Skip to content

Instantly share code, notes, and snippets.

View rohan20's full-sized avatar

Rohan Taneja rohan20

View GitHub Profile
@rohan20
rohan20 / product_list_item.dart
Created August 6, 2018 07:03
E-Commerce app using Flutter - Part 1: The User Interface
_buildDetailsAndMaterialWidgets() {
TabController tabController = new TabController(length: 2, vsync: this);
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TabBar(
controller: tabController,
tabs: <Widget>[
@rohan20
rohan20 / product_detail_page.dart
Created August 6, 2018 07:04
E-Commerce app using Flutter - Part 1: The User Interface
_buildBottomNavigationBar() {
return Container(
width: MediaQuery.of(context).size.width,
height: 50.0,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Flexible(
fit: FlexFit.tight,
@rohan20
rohan20 / product_list_item.dart
Created August 6, 2018 07:09
E-Commerce app using Flutter - Part 1: The User Interface
_buildProductItemCard(BuildContext context) {
return InkWell(
onTap: () {
Navigator.of(context).pushNamed(Constants.ROUTE_PRODUCT_DETAIL);
},
child: Card(
//rest of the widget
),
);
}
@rohan20
rohan20 / .htaccess
Created August 7, 2018 06:54
E-Commerce app using Flutter - Part 2: WooCommerce Dashboard Integration
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@rohan20
rohan20 / wp-config.php
Created August 7, 2018 06:56
E-Commerce app using Flutter - Part 2: WooCommerce Dashboard Integration
*<?php
/**
* The base configuration for WordPress
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
@rohan20
rohan20 / response.json
Last active August 7, 2018 08:07
E-Commerce app using Flutter - Part 3: Remote data
[
{
"id": 485,
"name": "Kids Cloth",
"slug": "kids-cloth",
"permalink": "http://flutterecommerce.geekydev.com/product/kids-cloth/",
"date_created": "2018-07-18T10:11:22",
"date_created_gmt": "2018-07-18T10:11:22",
"date_modified": "2018-07-18T10:12:41",
"date_modified_gmt": "2018-07-18T10:12:41",
@rohan20
rohan20 / product_list_item.dart
Created August 7, 2018 08:08
E-Commerce app using Flutter - Part 3: Remote data
class ProductsListItem extends StatelessWidget {
final Product product1;
final Product product2;
ProductsListItem({
@required this.product1,
@required this.product2,
});
@override
Widget build(BuildContext context) {
return Row(
@rohan20
rohan20 / products_list_page.dart
Last active August 7, 2018 08:18
E-Commerce app using Flutter - Part 3: Remote data
Future<dynamic> _getProductsByCategory(categoryId, pageIndex) async {
var response = await http.get(
RemoteConfig.config["BASE_URL"] +
RemoteConfig.config["BASE_PRODUCTS_URL"] +
"&category=$categoryId&per_page=6&page=$pageIndex",
headers: {
"Authorization": RemoteConfig.config["AuthorizationToken"],
},
).catchError(
(error) {
@rohan20
rohan20 / products_list_page.dart
Last active August 7, 2018 08:19
E-Commerce app using Flutter - Part 3: Remote data
var response = await http.get(
RemoteConfig.config["BASE_URL"] +
RemoteConfig.config["BASE_PRODUCTS_URL"] +
"&category=$categoryId&per_page=6&page=$pageIndex",
headers: {
"Authorization": RemoteConfig.config["AuthorizationToken"],
},
).catchError(
(error) {
return false;
@rohan20
rohan20 / remote_config.dart
Created August 7, 2018 08:12
E-Commerce app using Flutter - Part 3: Remote data
class RemoteConfig {
static final Map<dynamic, String> config = {
"AuthorizationToken": "MY_TOKEN",
"BASE_URL": "http://base_url.geekyants.com/",
"BASE_PRODUCTS_URL": "sub_url/products/",
};
}