Skip to content

Instantly share code, notes, and snippets.

View folaoluwafemi's full-sized avatar

Fola Oluwafemi folaoluwafemi

View GitHub Profile
@folaoluwafemi
folaoluwafemi / custom_outine_input_border.dart
Created January 6, 2023 11:35
custom outline input border that allows floating input label to be inside it.
import 'dart:math' as math;
import 'package:flutter/material.dart';
class CustomOutlineInputBorder extends InputBorder {
/// Creates an underline border for an [InputDecorator].
///
/// The [borderSide] parameter defaults to [BorderSide.none] (it must not be
/// null). Applications typically do not specify a [borderSide] parameter
/// because the input decorator substitutes its own, using [copyWith], based
@folaoluwafemi
folaoluwafemi / cached_state.dart
Last active February 25, 2023 14:08
dart mixin for locally caching state
import 'package:flutter/foundation.dart';
import 'package:hive_flutter/adapters.dart';
mixin CachedState<State, CachedType> {
///Function for serializing data from [State] to a more useable [CachedType]
///that can be stored easily by [Hive]
CachedType toCacheData();
///Function for serializing data from [CachedType] to a more useable [State]