This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/Esgrima/c0d4bff4b0d3909daf8994410cd659ce | |
// https://dartpad.dev/c0d4bff4b0d3909daf8994410cd659ce | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:boolean_selector/boolean_selector.dart'; | |
// (TODO: Tip # 1) Consider making frequently used variables/values constants | |
const _fooConst1 = ''; | |
const _fooConst2 = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class myscroll extends statelesswidget { | |
@override | |
widget build(buildcontext context) { | |
return new materialapp( | |
title: 'flutter demo', | |
theme: new themedata( | |
primaryswatch: colors.blue, | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
List<Map<String, dynamic>> myList = [ | |
{ | |
"Name": "Vent" | |
}, | |
{ | |
"Name": "Product" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adjancy list...which can be represent as python dictionary | |
graph = { | |
'A' : ['B','C'], | |
'B' : ['D', 'E'], | |
'C' : ['F'], | |
'D' : ['A'], | |
'E' : ['F'], | |
'F' : [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def romanToInt(self, s: str) -> int: | |
def value(r): | |
if (r == 'I'): | |
return 1 | |
if (r == 'V'): | |
return 5 | |
if (r == 'X'): | |
return 10 | |
if (r == 'L'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Container( | |
margin: EdgeInsets.symmetric(horizontal: 10), | |
child: InkWell( | |
customBorder: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(10), | |
), | |
onTap: () {}, | |
child: Ink( | |
height: 100, | |
decoration: BoxDecoration( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget getTextWidgets(List<String> strings) | |
{ | |
List<Widget> list = new List<Widget>(); | |
for(var i = 0; i < strings.length; i++){ | |
list.add(new Text(strings[i])); | |
} | |
return new Row(children: list); | |
} | |
// or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cubit expose its inner functions | |
// which can be called from outside to update its state | |
// the cubit functions are not stream which means they are pre defined functions. | |
import 'package:bloc/bloc.dart'; | |
class CounterCubit extends Cubit<int> { | |
CounterCubit() : super(0); | |
void increment() => emit(state + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:async"; | |
Stream<int> boatStream() async* { | |
for (int i = 0; i <= 10; i++) { | |
await Future.delayed(Duration(seconds: 2)); | |
yield i; | |
} | |
} | |
void main() { |
NewerOlder