Skip to content

Instantly share code, notes, and snippets.

View zahidshaikh08's full-sized avatar

Zahid Shaikh zahidshaikh08

View GitHub Profile
@y-pakorn
y-pakorn / flutter_web3_dapp_sample.dart
Last active August 15, 2023 16:26
Source code for Flutter Web3 Dapp Sample
import 'package:flutter/material.dart';
import 'package:flutter_web3/flutter_web3.dart';
import 'package:get/get.dart';
import 'package:niku/niku.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
class LocaleSharedManager {
static final LocaleSharedManager _instance = LocaleSharedManager._init();
static LocaleSharedManager get instance => _instance;
late final SharedPreferences _preferences;
LocaleSharedManager._init() {
SharedPreferences.getInstance().then((value) {
_preferences = value;
});
}
@rydmike
rydmike / main.dart
Last active June 2, 2021 13:07
A Flutter long press context menu. Wrap a child with LongPressPopupMenu and it pops up at press location with its PopupMenuItem:s
// BSD 3-Clause License
//
// Copyright (c) 2021, Mike Rydstrom (Rydmike)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
@slightfoot
slightfoot / anchor_scroll.dart
Last active January 27, 2021 00:28
Ever wanted to scroll down to a widget in a scroll view? Now you can, Anchor Scroll to the rescue! - by Simon Lightfoot - 15/11/2019
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / defer_init.dart
Last active July 19, 2023 12:51
Defer initialization of your UI based on a background service - by Simon Lightfoot - 29/12/2020 - Null Safe!
import 'dart:math' show Random;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show RendererBinding;
void main() {
runApp(MaterialApp(
home: Home(),
));
}
@lukepighetti
lukepighetti / text_editing_controller_builder.dart
Last active September 27, 2021 20:32
Wrap any TextField with TextEditingControllerBuilder to make it declarative
import 'package:flutter/widgets.dart';
class TextEditingControllerBuilder extends StatefulWidget {
/// Exposes a [TextEditingController] to the child, which allows
/// us to convert any [TextField] into a declarative version.
///
/// Typically used for wiring up many state fields to form inputs
/// and making sure everything stays in sync.
///
/// If [text] is updated, the consuming [TextField] will also be updated.
@lukepighetti
lukepighetti / unused_dependencies.js
Created September 4, 2020 14:26
Search a Flutter project for unused dependencies
/// Finds unused dependencies from pubspec.yaml
///
/// Achieves this by parsing pubspec.yaml and recursively
/// searching the lib folder for an import statement that
/// contains the name of each package. Prints out the results.
const fs = require("fs");
const YAML = require("yaml");
const { execSync } = require("child_process");
/// Read pubspec.yaml
Scrollable(
axisDirection: AxisDirection.right,
controller: _pageController,
physics: const PageScrollPhysics(parent: ClampingScrollPhysics()),
viewportBuilder: (BuildContext context, ViewportOffset offset) {
return LayoutBuilder(
builder: (context, constraints) {
offset.applyViewportDimension(constraints.maxWidth);
offset.applyContentDimensions(0.0, constraints.maxWidth);
return AnimatedBuilder(
@slightfoot
slightfoot / page_turn.dart
Created September 9, 2019 21:28
Page Turn Effect - By Simon Lightfoot. Replicating this behaviour. https://www.youtube.com/watch?v=JqvtZwIJMLo
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@debuggerx01
debuggerx01 / JumpToIndexDemo.dart
Created August 10, 2018 03:58
JumpToIndexDemoForFlutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rect_getter/rect_getter.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {