Notes
Notes - notes.io |
import 'package:flutter/material.dart';
class ListViewDisplay extends StatefulWidget {
const ListViewDisplay({Key key}) : super(key: key);
@override
_ListViewDisplayState createState() => _ListViewDisplayState();
}
class _ListViewDisplayState extends State<ListViewDisplay> {
final interval = const Duration(seconds: 1);
final int timerMaxSeconds = 60;
final int delaymaxseconds = 120;
final int showtimeseconds = 180;
final int displaytimeseconds = 240;
final int timedisplay = 320;
int currentSeconds = 0;
String get timerText =>
'${((timerMaxSeconds - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((timerMaxSeconds - currentSeconds) % 60).toString().padLeft(2, '0')}';
String get timerText1 =>
'${((delaymaxseconds - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((delaymaxseconds - currentSeconds) % 60).toString().padLeft(2, '0')}';
String get timerText2 =>
'${((showtimeseconds - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((showtimeseconds - currentSeconds) % 60).toString().padLeft(2, '0')}';
String get timerText3 =>
'${((displaytimeseconds - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((displaytimeseconds - currentSeconds) % 60).toString().padLeft(2, '0')}';
String get timerText4 =>
'${((timedisplay - currentSeconds) ~/ 60).toString().padLeft(2, '0')}: ${((timedisplay - currentSeconds) % 60).toString().padLeft(2, '0')}';
startTimeout([int milliseconds]) {
var duration = interval;
Timer.periodic(duration, (timer) {
setState(() {
print(timer.tick);
currentSeconds = timer.tick;
if (timer.tick >= timerMaxSeconds) timer.cancel();
});
});
}
showTimeout([int milliseconds]) {
var duration = interval;
Timer.periodic(duration, (timer) {
setState(() {
print(timer.tick);
currentSeconds = timer.tick;
if (timer.tick >= timerMaxSeconds) timer.cancel();
});
});
}
displayTimeout([int milliseconds]) {
var duration = interval;
Timer.periodic(duration, (timer) {
setState(() {
print(timer.tick);
currentSeconds = timer.tick;
if (timer.tick >= timerMaxSeconds) timer.cancel();
});
});
}
delaytimeout([int milliseconds]) {
var duration = interval;
Timer.periodic(duration, (timer) {
setState(() {
print(timer.tick);
currentSeconds = timer.tick;
if (timer.tick >= timerMaxSeconds) timer.cancel();
});
});
}
ShowTime([int milliseconds]) {
var duration = interval;
Timer.periodic(duration, (timer) {
setState(() {
print(timer.tick);
currentSeconds = timer.tick;
if (timer.tick >= timerMaxSeconds) timer.cancel();
});
});
}
@override
void initState() {
startTimeout();
showTimeout();
displayTimeout();
delaytimeout();
ShowTime();
super.initState();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
centerTitle: true,
title: Text(
"Stopwatch Implementation",
style: TextStyle(
fontSize: 18,
color: Colors.lightGreen,
fontWeight: FontWeight.bold),
),
),
body: ListView.builder(
padding: EdgeInsets.only(left: 10, right: 10, top: 30),
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: 5,
itemBuilder: (context, index) {
return Column(children: [
Container(
margin:
EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
height: 60,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.timer,
color: Colors.grey,
),
SizedBox(
width: 5,
),
index == 0
? Text(timerText)
: index == 1
? Text(timerText1)
: index == 2
? Text(timerText2)
: index == 3
? Text(timerText3)
: index == 4
? Text(timerText4)
: Text("Set Time")
],
))
]);
}),
));
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team