Skip to content

Instantly share code, notes, and snippets.

View VB10's full-sized avatar
🏠
Working from home

Veli Bacik VB10

🏠
Working from home
View GitHub Profile
@VB10
VB10 / shop_view.dart
Last active April 3, 2020 00:29
Shoppi - Home
class ShopView extends StatefulWidget {
@override
_ShopViewState createState() => _ShopViewState();
}
class _ShopViewState extends BaseState<ShopView> {
List<Product> subList = [];
int currentPage = 0;
@override
@VB10
VB10 / base_state.dart
Created April 3, 2020 00:45
Shoppi - BaseState
import 'package:flutter/material.dart';
import 'package:shoppingapp/core/constants/app_constants.dart';
import 'package:shoppingapp/core/constants/app_strings.dart';
abstract class BaseState<T extends StatefulWidget> extends State<T> {
ThemeData get currentTheme => Theme.of(context);
AppStrings get appStrings => AppStrings.instance;
AppConstants get appConstants => AppConstants.instance;
@VB10
VB10 / shop_list_view.dart
Last active April 3, 2020 00:52
Shoppi - Shop List View
class ShopListView extends StatefulWidget {
final bool isUserOnPage;
const ShopListView({Key key, this.isUserOnPage}) : super(key: key);
@override
_ShopListViewState createState() => _ShopListViewState();
}
class _ShopListViewState extends BaseState<ShopListView> {
ShopViewModel shopViewModel;
@VB10
VB10 / shop_view_detail.dart
Created April 3, 2020 01:12
Shoppi - Shop Detail
class ShopDetailView extends BaseStatelessWidget {
final Product data;
final int index;
ShopDetailView({Key key, this.data, this.index});
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
import 'dart:html' as html;
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import './pdf_web_view_view_model.dart';
class PdfWebViewView extends PdfWebViewViewModel {
String samplePdf = "http://www.africau.edu/images/default/sample.pdf";
@VB10
VB10 / pdf_web_view_view.dart
Created April 3, 2020 12:51
PDF View on Flutter Web
import 'dart:html' as html;
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import './pdf_web_view_view_model.dart';
class PdfWebViewView extends PdfWebViewViewModel {
String samplePdf = "http://www.africau.edu/images/default/sample.pdf";
@VB10
VB10 / shop_payment.dart
Last active April 3, 2020 14:06
Shoppi - Shop Payment
class ShopPaymentView extends StatefulWidget {
@override
_ShopPaymentViewState createState() => _ShopPaymentViewState();
}
class _ShopPaymentViewState extends BaseState<ShopPaymentView> {
int totalMoney = 0;
List<Product> get currentProductList =>
Provider.of<ProductListNotifier>(context, listen: false).productList;
@VB10
VB10 / base_config.dart
Last active April 3, 2020 14:29
Shoppi - Service
import 'dart:io';
import 'package:dio/dio.dart';
class BaseConfig {
Dio dio; // with default Options
String baseUrl;
BaseConfig() {
if (Platform.isIOS) {
@VB10
VB10 / shop_view_model.dart
Created April 3, 2020 14:47
Shoppi - Shop VM
class ShopViewModel extends BaseViewModel with ChangeNotifier {
// IO.Socket socket = IO.io(AppConstants.SOCKET_URL);
IO.Socket socket = IO.io(AppConstants.SOCKET_URL, <String, dynamic>{
'transports': ['websocket'],
// 'extraHeaders': {'foo': 'bar'} // optional
});
ProductService service = ProductService();
List<Product> subList = [];
@VB10
VB10 / number_circle_avatar.dart
Created April 3, 2020 14:53
Shoppi- Number Circle
import 'package:flutter/material.dart';
class NumberCircleAvatar extends StatelessWidget {
final int index;
const NumberCircleAvatar({Key key, this.index = 0}) : super(key: key);
@override
Widget build(BuildContext context) {
return CircleAvatar(
child: Text(