Skip to content

Instantly share code, notes, and snippets.

View vipulshah2010's full-sized avatar
🎯
Focusing

Vipul vipulshah2010

🎯
Focusing
View GitHub Profile
@vipulshah2010
vipulshah2010 / main.dart
Created August 10, 2023 12:51
solar-rainbow-0772
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@vipulshah2010
vipulshah2010 / main.dart
Created June 2, 2023 12:09
exquisite-snowflake-4839
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
class LoginInfo extends ChangeNotifier {
String get userName => _userName;
String _userName = '';
bool get loggedIn => _userName.isNotEmpty;
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
final GlobalKey<NavigatorState> _rootNavKey = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> _shellNavKey = GlobalKey<NavigatorState>();
void main() {
runApp(ShellRouteExampleApp());
}
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class Account {
const Account({required this.id, required this.transactions});
final String id;
final List<Transaction> transactions;
}
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
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
@vipulshah2010
vipulshah2010 / TimeDifference.java
Last active September 9, 2020 09:13
Time difference
boolean isValid(Date date1, Date date2) {
Timestamp timestamp1 = new Timestamp(date1.getTime());
Timestamp timestamp2 = new Timestamp(date2.getTime());
long milliseconds = timestamp2.getTime() - timestamp1.getTime();
int seconds = (int) milliseconds / 1000;
int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
seconds = (seconds % 3600) % 60;
@vipulshah2010
vipulshah2010 / PermissionDemoFragment.kt
Last active July 28, 2020 14:23
Permission handling using new ActivityResultContract API introduced in 1.2.0-alpha02 and Fragment 1.3.0-alpha02
class PermissionDemoFragment : BaseFragment<PermissionFragmentBinding>(),PermissionCallback {
private lateinit var permissionObserver: PermissionObserver
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
permissionObserver =
PermissionObserver(
requireActivity(),
public static void main(String[] args) {
System.out.println(parseEmoticons("How is it going? :) You are almost done :-)!"));
}
public static List<InlinedEmoticon> parseEmoticons(String text) {
if (text == null || text.length() == 0) {
return new ArrayList<>();
}
Map<String, Integer> map = new TreeMap<>();
map.put(":)", 1);