Skip to content

Instantly share code, notes, and snippets.

View iapicca's full-sized avatar
🎯
Focusing

Francesco Iapicca iapicca

🎯
Focusing
View GitHub Profile
@iapicca
iapicca / main.dart
Created October 6, 2019 15:44
Simple Singleton
class Singleton {
int _counter;
static final Singleton _instance = Singleton._internal();
factory Singleton()=> _instance;
Singleton._internal() {
_counter = 0;
}
@iapicca
iapicca / main.dart
Created October 6, 2019 16:24
Domino Timer
import 'dart:async';
class Singleton {
static final _instance = Singleton._internal();
factory Singleton() => _instance;
Singleton._internal() {}
Duration _delay = Duration();
Timer _reset;
void _timeout() => _delay = Duration();
@iapicca
iapicca / main.dart
Created October 7, 2019 10:09
Json Decode
import 'dart:convert';
const String _object_key = 'object';
const String _subset_key = 'subset';
const String _json = '{"object": [{"subset":"hello"},{"subset":" "},{"subset":"world"}]}';
void main() => print(jsonDecode(_json)[_object_key].map((d)=> d[_subset_key] as String).join());
@iapicca
iapicca / main.dart
Created October 9, 2019 15:00
Focus Node Test
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: MyHomePage(),),);
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@iapicca
iapicca / main.dart
Last active December 30, 2019 17:53
Lorem ipsum maxLines + extOverflow.ellipsis
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp( home: MyHomePage(),);
}
class MyHomePage extends StatelessWidget {
@iapicca
iapicca / main.dart
Last active October 23, 2019 07:01
emoji
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
static const String _message = '🐣';
@override
Widget build(BuildContext context) => MaterialApp(
@iapicca
iapicca / main.dart
Created October 24, 2019 10:54
Axis change bug
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: MyApp()));
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@iapicca
iapicca / main.dart
Last active November 8, 2023 23:23
TapGestureRecognizer + SelectableText conflict
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(home: MyHome()),);
}
class MyHome extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
@iapicca
iapicca / main.dart
Created November 1, 2019 08:13
Sliver Scrolling Test
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: MyApp()));
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: CustomScrollView(
slivers: <Widget>[
@iapicca
iapicca / main.dart
Created November 1, 2019 08:57
DropDown Example
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: MyApp()));
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: Center(
child:DropDownWidget(),),);
}