Skip to content

Instantly share code, notes, and snippets.

View tayormi's full-sized avatar
🥰
Working Silently

Temitope Ajiboye tayormi

🥰
Working Silently
View GitHub Profile
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
// Offset from offscreen below to stopping below the top of the screen.
final Animatable<Offset> _kBottomUpTween = Tween<Offset>(
begin: const Offset(0.0, 1.0),
@tayormi
tayormi / custom_timer_widget.dart
Created December 5, 2024 00:20
A custom timer Flutter widget
import 'dart:math';
import 'package:flutter/material.dart';
class CustomTimerWidget extends LeafRenderObjectWidget {
final double progress;
final String remainingTime;
final String label;
final VoidCallback? onTap;
@tayormi
tayormi / email.dart
Last active March 17, 2023 14:31
Riverpod Field Validation
import 'package:formz/formz.dart';
enum EmailValidationError { invalid }
class Email extends FormzInput<String, EmailValidationError> {
Email.pure([super.value = '']) : super.pure();
Email.dirty([super.value = '']) : super.dirty();
static final _emailRegExp = RegExp(
void main() {
onSelectNotification('agencyNotification', 'HereThere');
}
void onSelectNotification(String type, String data) {
switch (type) {
case 'agencyNotification':
case 'newAdsInSearch':
if(data == 'HereThere') {
print("Handle Search");
enum MD2IndicatorSize {
tiny,
normal,
full,
}
class MD2Indicator extends Decoration {
final double indicatorHeight;
final Color indicatorColor;
final MD2IndicatorSize indicatorSize;
@tayormi
tayormi / printNumbers.dart
Created July 9, 2021 09:03
Dart program that prints each number from 1 to 100 on a new line.
void main() {
// Function to print numbers from 1 to 100, display Bud when in multiples of 3
// Display Vue when in multiples of 5
// Display "Budvue should consider $yourName for this position" when in multiples of both 3 and 5
printNumbers(1, 100);
}
void printNumbers(int start, int end) {
var yourName = "Temitope Ajiboye";
for (var i = start; i <= end; i++) {
//show mutliples of 3
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
part 'request_state_notifier.freezed.dart';
class RequestStateNotifier<T> extends StateNotifier<RequestState<T>> {
RequestStateNotifier() : super(RequestState.idle());
Future<RequestState<T>> makeRequest(Future<T> Function() function) async {
try {
import 'package:quiver/async.dart';
CountdownTimer _countdownTimer;
Listener(
behavior: HitTestBehavior.translucent,
onPointerMove: (_) {
_countdownTimer =
CountdownTimer(Duration(minutes: 5), Duration(seconds: 1));
},
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
part 'request_state_notifier.freezed.dart';
abstract class RequestStateNotifier<T> extends StateNotifier<RequestState<T>> {
RequestStateNotifier() : super(RequestState.idle());
//It returns a Future with state if you want to avoid ProviderListener
Future<RequestState<T>> makeRequest(Future<T> Function() function) async {
extension StringExtension on String {
String get svg => 'assets/images/svg/$this.svg';
String get png => 'assets/images/png/$this.png';
}
// Then you can do this
SvgPicture.asset(
'back'.svg,
height: 16,
width: 16,