fancy_timer 1.0.1 fancy_timer: ^1.0.1 copied to clipboard
A customizable flutter widget that produces a fancy timer with multiple customizable options
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:fancy_timer/fancy_timer.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://images.pexels.com/photos/2253870/pexels-photo-2253870.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'),
fit: BoxFit.cover,
),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.0)),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'The wedding will begin in...',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: Colors.pink,
),
),
SizedBox(height: 8),
FancyTimer(
duration: Duration(seconds: 10),
onTimerEnd: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://images.pexels.com/photos/2253870/pexels-photo-2253870.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'),
fit: BoxFit.cover,
),
),
),
),
),
);
},
),
],
),
),
),
),
),
);
}
}