Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
@immutable
class ClipShadowPath extends StatelessWidget {
final Shadow shadow;
final CustomClipper<Path> clipper;
final Widget child;
ClipShadowPath({
@required this.shadow,
@gmgm60
gmgm60 / main.dart
Created August 20, 2024 17:52
future cannot be canceled
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@gmgm60
gmgm60 / fluttercleanrecursive.sh
Created April 21, 2024 07:21 — forked from jeroen-meijer/fluttercleanrecursive.sh
Flutter Clean Recursive - Clear up space on your hard drive by cleaning your Flutter projects. This script searches for all Flutter projects in this directory and all subdirectories and runs 'flutter clean'. Note: may take a long time for folders with large amounts of projects.
#!/bin/sh
# To run, download the script or copy the code to a '.sh' file (for example 'fluttercleanrecursive.sh') and run like any other script:
# sh ./fluttercleanrecursive.sh
# or
# sudo sh fluttercleanrecursive.sh
echo "Flutter Clean Recursive (by jeroen-meijer on GitHub Gist)"
echo "Looking for projects... (may take a while)"
@gmgm60
gmgm60 / main.dart
Last active March 13, 2023 15:26
save file from assets
Future<void> downloadFile(String assetPath)async{
/// get the data from the asset file.
final ByteData data = await rootBundle.load(assetPath);
final List<int> bytes = data.buffer.asUint8List();
final directory = await getDownloadsDirectory();
/// get the file name & extension from the asset file.
@gmgm60
gmgm60 / main.dart
Created October 15, 2022 21:12
Counter example
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@gmgm60
gmgm60 / main.dart
Created September 14, 2022 08:57
lively-rhythm-4449
class Employee {
String? name;
double? salary;
String? email;
// default constructor
// Employee(String na, double sal, String emai) {
// name = na;
// salary = sal;
@gmgm60
gmgm60 / main.dart
Created September 7, 2022 07:28
lively-rhythm-4449
main() {
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[1], "red", "small");
inc(shoppingCart[2], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
@gmgm60
gmgm60 / main.dart
Created September 6, 2022 18:47
lively-rhythm-4449
main() {
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[1], "red", "small");
inc(shoppingCart[2], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
inc(shoppingCart[0], "red", "small");
dec(shoppingCart[0], "red", "small");
@gmgm60
gmgm60 / readme.md
Last active September 6, 2022 18:41
shoppingCart
@gmgm60
gmgm60 / shoppingCart
Created September 6, 2022 18:34
shoppingCart
List<Map<String, dynamic>> shoppingCart = [
{
'name': 'Jeans',
'price': 160,
'availableQty': [
{"color": "red", "size": "small"}
],
'selectedQty': [
{"color": "red", "size": "small"}
],