Skip to content

Instantly share code, notes, and snippets.

@PiN73
PiN73 / main.dart
Created May 4, 2021 11:38
Flutter AnimatedSwitcher SlideTransition
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp();
@PiN73
PiN73 / !.md
Last active April 22, 2025 03:04
WPF ScrollViewer virtualization AND smooth scroll. Full: https://github.com/PiN73/TestScrollVirtualization/

By default, <ItemsControl>/<ScrollViewer> doesn't use virtualization. All its items are rendered at once. This causes lags/freezing on first render and each re-render (for example, if list data or window size changes).

Adding ScrollViewer.CanContentScroll="True" will enable virtualization and make loading fast. But the list will be scrolled one whole item a time, which feels like jumping if items height is big enough.

To make virtualization enabled and keep smooth scrolling, add also VirtualizingPanel.ScrollUnit="Pixel"

@PiN73
PiN73 / main.dart
Last active August 15, 2020 00:07
Flutter slivers (CustomScrollView) example
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@PiN73
PiN73 / main.dart
Last active August 1, 2020 23:55
Column with Icon baseline fixed
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@PiN73
PiN73 / main.dart
Created August 1, 2020 23:38
Column with Icon baseline
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@PiN73
PiN73 / main.dart
Last active August 1, 2020 23:33
Column baseline
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/foundation.dart';
extension NumExtension on num {
bool greaterThan(num other) => this > other;
}
class MyClass {
final bool a;
final bool b;
final bool c;
@PiN73
PiN73 / main.dart
Created March 1, 2020 20:32
Dart map assign
void main() {
Map<int, MapEntry<String, String>> m = {};
m[5] = MapEntry("five", "5");
print(m);
}
@PiN73
PiN73 / doctor.log
Created November 15, 2019 15:04
flutter doctor
C:\Users\Pavel\AndroidStudioProjects\test_functional_widget>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.18362.418], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)
• No issues found!