Skip to content

Instantly share code, notes, and snippets.

View pishguy's full-sized avatar
✍️
Focusing

Mahdi Pishguy pishguy

✍️
Focusing
View GitHub Profile
@rohan20
rohan20 / main.dart
Created January 7, 2022 16:43
Flutter Marquee text or normal Text as needed
import 'package:flutter/material.dart';
import 'package:marquee/marquee.dart';
/// Marquee text along Axis.horizontal for the purpose of the demo.
class MaybeMarqueeText extends StatelessWidget {
final String text;
final double height;
final double maxWidth;
const MaybeMarqueeText(
@sbosell
sbosell / network_detector_notifier.dart
Created September 22, 2020 11:50
Riverpod Network Detection Example
import 'dart:async';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
enum NetworkStatus { NotDetermined, On, Off }
class NetworkDetectorNotifier extends StateNotifier<NetworkStatus> {
StreamController<ConnectivityResult> controller =
@slightfoot
slightfoot / MainActivity.java
Created April 2, 2020 12:55
Draw Under System Ui in Flutter
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity
@slightfoot
slightfoot / page_view_with_cache.dart
Last active April 16, 2020 17:30
PageView with CacheExtent - by Simon Lightfoot - 15/01/2020
// MIT License
//
// Copyright (c) 2020 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 / main.dart
Created February 27, 2020 20:00
Curved Background Login Form Example - Utilises overdraw of the CustomPaint to draw the curve behind the content even when the keyboard appears.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@slightfoot
slightfoot / cached_network_image.dart
Created February 27, 2020 16:57
Cached Network Image
// MIT License
//
// Copyright (c) 2020 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:
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@slightfoot
slightfoot / transitions_fun.dart
Created January 8, 2020 21:31
Fun with Route Animations - by Simon Lightfoot - #HumpDayQandA - 8th Janurary 2020
// 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:
import 'package:flutter/material.dart';
class FadeIndexedStack extends StatefulWidget {
final int index;
final List<Widget> children;
final Duration duration;
const FadeIndexedStack({
Key key,
this.index,
@slightfoot
slightfoot / fling_physics.dart
Last active May 19, 2023 14:59
Fling PageScrollPhysics for Flutter
// MIT License
//
// Copyright (c) 2023 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: