Skip to content

Instantly share code, notes, and snippets.

View pratikbutani's full-sized avatar
🎯
Exploring things

Pratik Butani pratikbutani

🎯
Exploring things
View GitHub Profile
@pratikbutani
pratikbutani / index.html
Last active March 7, 2023 17:56
Dart with HTML & CSS
<html>
<head>
<meta charset="UTF-8">
<title>Dart + HTML + CSS Example</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Click the button to change the color of the text!</h1>
<br><br>
<button id="colorButton">Change color</button>
@pratikbutani
pratikbutani / dart_isolation.dart
Created March 2, 2023 07:32
Dart Isolation Sample
import 'dart:isolate';
void main() async {
final receivePort = ReceivePort();
final isolate = await Isolate.spawn(doHeavyWork, receivePort.sendPort);
receivePort.listen((data) => print('Result: $data'));
}
void doHeavyWork(SendPort sendPort) {
// Perform some CPU-intensive work here
@pratikbutani
pratikbutani / main.dart
Last active October 16, 2022 14:01
Change color of border & IconData in TextInput
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@pratikbutani
pratikbutani / main.dart
Last active October 16, 2022 13:51
StatefulBuilder Use case with AlertDialog
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@pratikbutani
pratikbutani / main.dart
Created October 13, 2022 13:07
BottomSheet with TextInputBox & Keyboard
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
static const String _title = 'Flutter Code Sample';
@override
@pratikbutani
pratikbutani / main.dart
Last active October 1, 2022 14:59
Round Container With Image in Flutter
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@pratikbutani
pratikbutani / demo_clipper.dart
Created June 21, 2022 09:33
Clipper Demo using Container in Row (Clip a part of container)
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@pratikbutani
pratikbutani / main.dart
Created April 3, 2021 12:49
Flutter onChange of TextField getting call on keyboard hide (via back press)
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@pratikbutani
pratikbutani / main.dart
Created February 22, 2021 05:31 — forked from filiph/main.dart
Human Life Counter
// This now lives in https://github.com/filiph/human-life/blob/main/lib/main.dart as source
// and at https://filiph.github.io/human-life/ as an app.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(HumanLifeApp());
}
@pratikbutani
pratikbutani / country-flag.json
Created October 9, 2020 10:05
A JSON for Country List with Flag Image
[
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e8.svg",
"country": "Ascension Island",
"code": "ac"
},
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e9.svg",
"country": "Andorra",
"code": "ad"