Skip to content

Instantly share code, notes, and snippets.

@VB10
Created September 21, 2022 23:28
Show Gist options
  • Select an option

  • Save VB10/578d1ba0ce2ee29c917068e96f669c3d to your computer and use it in GitHub Desktop.

Select an option

Save VB10/578d1ba0ce2ee29c917068e96f669c3d to your computer and use it in GitHub Desktop.
Duration Values
import 'package:flutter/material.dart';
enum Durations {
low(Duration(milliseconds: 500)),
normal(Duration(seconds: 1)),
high(Duration(seconds: 3));
final Duration value;
const Durations(this.value);
}
class HomeTest extends StatelessWidget {
const HomeTest({super.key});
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(Durations.normal.value),
builder: (BuildContext context, AsyncSnapshot snapshot) => const SizedBox(),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment