Skip to content

Instantly share code, notes, and snippets.

View tranductam2802's full-sized avatar
🔥
Fulltime Mobile Developer! Part-time Poker dealer

Trần Đức Tâm tranductam2802

🔥
Fulltime Mobile Developer! Part-time Poker dealer
View GitHub Profile
@nseidm1
nseidm1 / scroll_to_bottom.dart
Created April 25, 2019 21:04
Dart scroll to bottom
import 'package:flutter/material.dart';
class ScrollToBottomController extends ScrollController {
ScrollToBottomController({
@required Listenable listenable,
double initialScrollOffset = 0.0,
bool keepScrollOffset = true,
String debugLabel,
}) : _listenable = listenable,
super(
import 'package:flutter/material.dart';
class PageMain extends StatefulWidget {
@override
_PageMainState createState() => _PageMainState();
}
class _PageMainState extends State<PageMain> {
CustomScrollController firstScroll = CustomScrollController();
CustomScrollController secondScrollController = CustomScrollController();
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
class App extends StatefulWidget {
@override
State<App> createState() => _AppState();
}
@yunyu
yunyu / snapping_list_view.dart
Last active October 1, 2023 02:32
A Flutter PageView replacement/snapping ListView for fixed-extent items
import "package:flutter/widgets.dart";
import "dart:math";
class SnappingListView extends StatefulWidget {
final Axis scrollDirection;
final ScrollController controller;
final IndexedWidgetBuilder itemBuilder;
final List<Widget> children;
final int itemCount;
@ajinasokan
ajinasokan / example.dart
Last active November 26, 2019 10:06
Futter nested TabBarView bug
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
@slightfoot
slightfoot / ensure_visible.dart
Last active July 12, 2021 04:43
DEPRECATED. (Now integrated Into Flutter!!!). Ensure Visible for Flutter. Makes sure TextField or other widgets are scrolled into view when they receive input focus. Just pass the focusNode provided to your TextField inside the builder.
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
/// Signature for a function that creates a widget with the supplied [FocusNode].
typedef Widget EnsureVisibleBuilder(BuildContext context, FocusNode focusNode);
/// A widget that ensures it is always visible inside its ancestor scrollable
/// when focused.
class EnsureVisible extends StatefulWidget {
@slightfoot
slightfoot / animated_bottom_bar.dart
Last active November 26, 2019 10:06
Animated Bottom Bar (fixed bug where Material shadow was clipped from BottomNavigationBar.)
// Copyright 2018 Simon Lightfoot. All rights reserved.
// Use of this source code is governed by a MIT license that can be
// found in the LICENSE file.
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
/// Animated Bottom Bar.
@collinjackson
collinjackson / main.dart
Last active January 29, 2025 06:06
Demonstrates scrolling a focused widget into view
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
/// A widget that ensures it is always visible when focused.
@yanngx
yanngx / FragmentArgumentDelegate.kt
Last active January 19, 2023 09:26
Fragment arguments without hassle !
package be.brol
import android.os.Binder
import android.os.Bundle
import android.support.v4.app.BundleCompat
import android.support.v4.app.Fragment
/**
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate
* Just write the property in newInstance and read it like any other property after the fragment has been created
@orakaro
orakaro / introrx.md
Created July 2, 2016 08:58 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing