// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:date_count_down/date_count_down.dart';
class CustomTimer extends StatefulWidget {
const CustomTimer({
super.key,
required this.width,
required this.height,
required this.textcolor,
required this.courseDate,
required this.textsize,
});
final double? width;
final double? height;
final Color textcolor;
final DateTime courseDate;
final double textsize;
@override
State<CustomTimer> createState() => _CustomTimerState();
}
class _CustomTimerState extends State<CustomTimer> {
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CountDownText(
due: widget.courseDate,
finishedText: "text when the timer goes off",
showLabel: true,
longDateName: true,
daysTextLong: " Days ",
hoursTextLong: " hours ",
minutesTextLong: " minutes ",
secondsTextLong: " seconds ",
style: TextStyle(
color: (widget.textcolor),
fontWeight: FontWeight.bold,
fontSize: widget.textsize),
)
],
);
}
}
Hi, I ran into a problem with Flutterflow countdown, I wanted it to count down days hours minutes and seconds, but it only had the option for hours minutes and seconds. For this reason I wrote code for such type of timer.
NOTE: To use the code add ''date_count_down: ^3.0.0" in pubsec dependencies.