Skip to content

Instantly share code, notes, and snippets.

@faizan1947
Last active May 10, 2021 12:00
Show Gist options
  • Save faizan1947/f00ec5a8257a2e1b8d1ab8f26c1de99b to your computer and use it in GitHub Desktop.
Save faizan1947/f00ec5a8257a2e1b8d1ab8f26c1de99b to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:date_format/date_format.dart';
class TEST extends StatefulWidget {
@override
_TESTState createState() => _TESTState();
}
class _TESTState extends State<TEST> {
String currentDate = formatDate(DateTime.now(), [mm, '-', dd, '-', yyyy]);
//String saturday = formatDate(DateTime(5), [DD]) ;
int currentDay = formatDate(DateTime(DateTime.now().weekday), [DD]) as int;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
setState(() {
int currentDay = 7;
switch (currentDay) {
case 1: {
print(" number 1");
} break;
case 2: {
print(" number 2");
} break;
case 3: {
print(" number 3");
} break;
case 4: {
print(" number 4");
} break;
case 5: {
print(" number 5");
} break;
case 6: {
print(" number 6");
} break;
case 7: {
print(" number 7");
} break;
default: {
print("This is default case");
} break;
}
});
},
child: Text('s'),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment