Skip to content

Instantly share code, notes, and snippets.

@gabbygreat
gabbygreat / main.dart
Created April 6, 2025 15:29
Dynamic ScrollPhysics
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@gabbygreat
gabbygreat / main.dart
Created March 5, 2025 21:48
Tabbar Renderbox
import 'package:flutter/material.dart';
class TabModel {
String name;
String emoji;
List<String> content;
TabModel({
required this.content,
required this.name,
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await NotificationService.instance.initialize();
//YOUR OTHER CODE CAN COME IN HERE
runApp(const MyApp());
@BarryDaBee
BarryDaBee / app_slidable.dart
Created February 24, 2025 06:38
Flutter Hook implementation of a Slidable widget that snaps to parentWidth / 2 and automatically closes on swipe. This was created because flutter_slidable's action buttons always fill the parent height, which is not always the intended behavior.
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
class AppSlidable extends HookWidget {
const AppSlidable({
required this.child,
required this.actions,
super.key,
});
@BarryDaBee
BarryDaBee / app_typography.dart
Last active February 7, 2025 06:41
A robust approach to handling app typography using theme_extensions for large scale apps with SOLID principles. PS: Open to questions, suggestions and improvements.
import 'package:flutter/material.dart';
abstract class AppTypography {
AppTypography({
required this.name,
required this.regular,
required this.medium,
required this.semiBold,
required this.bold,
});
@Software78
Software78 / build.gradle
Last active May 10, 2025 23:47
LadyBug fix
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:task_naija/constants/app_colors.dart';
import 'package:task_naija/widgets/app_buttons.dart';
class CustomDialog extends StatefulWidget {
final String image;
final String title;
final String subtitle;
@LordGhostX
LordGhostX / validate_email.py
Last active August 13, 2023 17:09
RegEX to validate email
# validate email addresses
def validate_email(email):
pattern = r"(^(?!-|\.)([a-zA-Z0-9._%+-]+)@(?!-)[a-zA-Z0-9.-]+(?<=[a-zA-Z0-9])\.[a-zA-Z]{2,}$)"
if re.match(pattern, email):
return True
else:
return False
if __name__ == "__main__":
@folaoluwafemi
folaoluwafemi / custom_animation_builder.dart
Last active June 27, 2023 17:05
A simple but useful widget to implement animation, it provides a builder that exposes the current animation value, and calls the build method at every tick.
import 'package:flutter/widgets.dart';
typedef CustomAnimationBuilderCallback = Widget Function(
BuildContext context,
double value,
Widget? child,
);
class CustomAnimationBuilder extends StatefulWidget {
final Duration duration;
@folaoluwafemi
folaoluwafemi / multi_point_scroll_view.dart
Created May 5, 2023 15:21
A SingleChildScrollView that allows control over the number of pointers that trigger scrolling
// ignore_for_file: lines_longer_than_80_chars
import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide ScrollableState;
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';