Skip to content

Instantly share code, notes, and snippets.

View andreciornavei's full-sized avatar
🔥
Working on fire.

André Ciornavei andreciornavei

🔥
Working on fire.
View GitHub Profile
@andreciornavei
andreciornavei / flutter_either.dart
Created October 25, 2020 16:24
Flutter / Either / Dartz - Execute actions based on Left/Right properties of Either
import 'package:dartz/dartz.dart';
class EitherExample {
Future<Either<Failure, Entity>> handle() async {
try{
Entity entity = new Entity()
if(entity.document == null) throw Exception("Document is null");
return Right(entity);
}catch(error){
@andreciornavei
andreciornavei / custom_appbar.dart
Last active November 6, 2020 00:17
Flutter / Scaffold / appBar - Custom appBar widget to place on Scaffold
class CustomAppBar extends PreferredSize {
@override
Size get preferredSize => Size.fromHeight(50);
@override
Widget build(BuildContext context) {
return Container(
height: preferredSize.height,
color: Colors.white,
alignment: Alignment.center,
child: SafeArea(
@andreciornavei
andreciornavei / getx_bottomsheet.dart
Last active April 30, 2024 20:57
GetX - BottomSheet - Fit Height
Get.bottomSheet(
SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
),