cpd/lib/pages/homepage.dart

156 lines
4.4 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cpd/widgets/listview.dart';
import 'package:cpd/widgets/popup.dart';
final List<double> data = [50, 80, 120, 60, 150];
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
useMaterial3: true,
),
home: const MyHomePage(title: 'Homepage'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 180,
flexibleSpace: ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
child: Stack(
children: [
Image.asset(
'assets/appbar_background.png',
width: double.infinity,
fit: BoxFit.cover,
),
const Positioned(
top: 20,
left: 20,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'step by step, day by day',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Arial',
fontSize: 14,
),
),
SizedBox(height: 10),
Text(
'You have #habitCounter for today',
style: TextStyle(
color: Colors.black,
fontFamily: 'Roboto',
fontSize: 16,
),
),
],
),
),
],
),
),
),
body: Padding(
padding: const EdgeInsets.only(top: 20),
child: Center(
child: Container(
width: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration(
color: Colors.green[100],
borderRadius: const BorderRadius.all(Radius.circular(25)),
),
child: Column(
children: <Widget>[
const Text(
'Keep going queen',
style: TextStyle(
fontSize: 16.0,
color: Colors.black,
fontFamily: 'Roboto'
),
),
const SizedBox(height: 8.0),
const ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(30))),
SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
child: const LinearProgressIndicator(
minHeight: 10,
color: Colors.green,
backgroundColor: Colors.white24,
value: 0.3, // Hier kannst du den Fortschritt des Indikators anpassen
),
),
const Padding(
padding: EdgeInsets.only(top: 10),
child: Divider(thickness: 3,),
),
Expanded(child: MyListView())
],
)
),
),
),
floatingActionButton: FloatingActionButton(
foregroundColor: Colors.deepPurpleAccent,
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AddHabitPopup(
onHabitAdded: () {
setState(() {});
},
);
},
);
},
child: const Icon(Icons.add),
),
);
}
}