Created
January 27, 2024 14:39
-
-
Save gleicon/1f81f4c1d62d8a162ac257e547b8fd70 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData.dark().copyWith( | |
colorScheme: ColorScheme.dark( | |
primary: Colors.red, | |
secondary: Colors.pink, | |
), | |
), | |
home: FastingApp(), | |
); | |
} | |
} | |
class FastingApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.black, | |
body: SafeArea( | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Icon(Icons.check_circle, color: Colors.grey), | |
Text( | |
'Zero', | |
style: TextStyle(color: Colors.red, fontSize: 24.0, fontWeight: FontWeight.bold), | |
), | |
Icon(Icons.add, color: Colors.white), | |
], | |
), | |
), | |
SizedBox(height: 8.0), | |
WeekIndicator(), | |
Expanded( | |
child: Center( | |
child: FastingTimer(), | |
), | |
), | |
StartFastingButton(), | |
SizedBox(height: 16.0), | |
BottomAction(), | |
BottomNavigationBar(), | |
], | |
), | |
), | |
); | |
} | |
} | |
class WeekIndicator extends StatelessWidget { | |
final List<String> days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: days.map((day) { | |
bool isActive = day == 'WED' || day == 'THU' || day == 'FRI'; | |
return Column( | |
children: [ | |
CircleAvatar( | |
radius: 6.0, | |
backgroundColor: isActive ? Colors.green : Colors.grey, | |
), | |
SizedBox(height: 4.0), | |
Text( | |
day, | |
style: TextStyle(color: Colors.white, fontSize: 12.0), | |
), | |
], | |
); | |
}).toList(), | |
), | |
); | |
} | |
} | |
class FastingTimer extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
alignment: Alignment.center, | |
children: [ | |
Container( | |
width: 240.0, | |
height: 240.0, | |
decoration: BoxDecoration( | |
color: Colors.grey[900], | |
shape: BoxShape.circle, | |
), | |
), | |
Positioned( | |
top: 100.0, | |
child: Text( | |
'Time Since Last Fast', | |
style: TextStyle(color: Colors.grey, fontSize: 16.0), | |
), | |
), | |
Positioned( | |
top: 130.0, | |
child: Text( | |
'2 days', | |
style: TextStyle(color: Colors.white, fontSize: 48.0, fontWeight: FontWeight.bold), | |
), | |
), | |
Positioned( | |
top: 10.0, | |
right: 10.0, | |
child: CircleAvatar( | |
radius: 12.0, | |
backgroundColor: Colors.grey[800], | |
child: Text( | |
'13', | |
style: TextStyle(color: Colors.white, fontSize: 12.0), | |
), | |
), | |
), | |
], | |
); | |
} | |
} | |
class StartFastingButton extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 32.0), | |
child: ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
primary: Colors.pink, | |
padding: EdgeInsets.symmetric(vertical: 16.0), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(32.0), | |
), | |
), | |
onPressed: () {}, | |
child: Center( | |
child: Text( | |
'Start Fasting', | |
style: TextStyle(fontSize: 18.0), | |
), | |
), | |
), | |
); | |
} | |
} | |
class BottomAction extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 8.0), | |
child: ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
primary: Colors.grey[900], | |
padding: EdgeInsets.symmetric(vertical: 16.0), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(32.0), | |
), | |
), | |
onPressed: () {}, | |
child: Center( | |
child: Text( | |
'What are you eating?', | |
style: TextStyle(fontSize: 18.0), | |
), | |
), | |
), | |
); | |
} | |
} | |
class BottomNavigationBar extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return BottomAppBar( | |
color: Colors.black, | |
child: Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 8.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
IconButton( | |
icon: Icon(Icons.home, color: Colors.red), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.explore, color: Colors.white), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.person, color: Colors.white), | |
onPressed: () {}, | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment