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 _MyChoiceChipState extends State<MyChoiceChip> { | |
// List<ChoiceChipData> chips = ChoiceChipAll.all; | |
List<String> _options = [ | |
'9th Class', | |
'10th Class', | |
'Fsc Part 1', | |
'Fsc Part 2', | |
'Entry test' | |
]; | |
int _selectedIndex; |
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() { |
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
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
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
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
# 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
/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
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
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, | |
), |
OlderNewer