From 18bbdce26138806c5959e823b2598ee451be637f Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Tue, 23 Apr 2024 10:01:29 +0200 Subject: [PATCH] initial commit --- lib/data/booking.dart | 172 +++++++++++ lib/data/publicHolidays.dart | 135 +++++++++ lib/main.dart | 159 ++++------- lib/widgets/monthly/monthlyScreen.dart | 268 ++++++++++++++++++ lib/widgets/tabsScreen.dart | 64 +++++ lib/widgets/yearly/yearlyScreen.dart | 21 ++ macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 248 +++++++++++++++- pubspec.yaml | 23 +- 9 files changed, 979 insertions(+), 115 deletions(-) create mode 100644 lib/data/booking.dart create mode 100644 lib/data/publicHolidays.dart create mode 100644 lib/widgets/monthly/monthlyScreen.dart create mode 100644 lib/widgets/tabsScreen.dart create mode 100644 lib/widgets/yearly/yearlyScreen.dart diff --git a/lib/data/booking.dart b/lib/data/booking.dart new file mode 100644 index 0000000..200a1b4 --- /dev/null +++ b/lib/data/booking.dart @@ -0,0 +1,172 @@ +import 'package:intl/intl.dart'; + +import 'package:flutter/material.dart'; +import 'package:syncfusion_flutter_datagrid/datagrid.dart'; +import 'package:workinghours/data/publicHolidays.dart'; + +class Booking { + DateTime bookingDay; + DateTime come1; + DateTime leave1; + DateTime come2; + DateTime leave2; + DateTime come3; + DateTime leave3; + DateTime come4; + DateTime leave4; + DateTime come5; + DateTime leave5; + String code; + String information; + + String holiday = ''; + String dayLeft = ''; + String dayRight = ''; + String pause = ''; + String durationIs = ''; + String durationShould = ''; + String diff = ''; + String currentDiff = ''; + String decimal = ''; + + Booking({ + required this.bookingDay, + required this.come1, + required this.leave1, + required this.come2, + required this.leave2, + required this.come3, + required this.leave3, + required this.come4, + required this.leave4, + required this.come5, + required this.leave5, + required this.code, + required this.information, + }) { + PublicHolidays h = PublicHolidays(year: bookingDay.year); + + holiday = h.holiday(bookingDay); + dayLeft = DateFormat('EEEE - dd').format(bookingDay); + dayRight = DateFormat('dd - EEEE').format(bookingDay); + pause = ''; + durationIs = ''; + durationShould = ''; + diff = ''; + currentDiff = ''; + decimal = ''; + } + +// factory Booking.fromJson(Map json) { +// return Movie( +// movieID: int.parse(json['movieID']), +// movieTitle: json['movieTitle'] as String, +// overview: json['overview'] as String, +// releaseDate: DateTime.parse(json['releaseDate']), +// state: int.parse(json['state']), +// resolution: json['resolution'] as String, +// ); +// } +} + +class BookingDataSource extends DataGridSource { + /// Creates the employee data source class with required details. + BookingDataSource(this.booking) { + buildDataGridRow(); + } + + void buildDataGridRow() { + _bookingDataGridRows = booking + .map((e) => DataGridRow(cells: [ + DataGridCell(columnName: 'dayLeft', value: e.dayLeft), + DataGridCell(columnName: 'holiday', value: e.holiday), + DataGridCell( + columnName: 'come1', + value: e.come1.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.come1)), + DataGridCell( + columnName: 'leave1', + value: e.leave1.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.leave1)), + DataGridCell( + columnName: 'come2', + value: e.come2.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.come2)), + DataGridCell( + columnName: 'leave2', + value: e.leave2.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.leave2)), + DataGridCell( + columnName: 'come3', + value: e.come3.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.come3)), + DataGridCell( + columnName: 'leave3', + value: e.leave3.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.leave3)), + DataGridCell( + columnName: 'come4', + value: e.come4.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.come4)), + DataGridCell( + columnName: 'leave4', + value: e.leave4.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.leave4)), + DataGridCell( + columnName: 'come5', + value: e.come5.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.come5)), + DataGridCell( + columnName: 'leave5', + value: e.leave5.year == 1900 + ? '99:99' + : DateFormat('hh:mm').format(e.leave5)), + DataGridCell(columnName: 'pause', value: e.pause), + DataGridCell(columnName: 'code', value: e.code), + DataGridCell( + columnName: 'durationIs', value: e.durationIs), + DataGridCell( + columnName: 'durationShould', value: e.durationShould), + DataGridCell(columnName: 'diff', value: e.diff), + DataGridCell( + columnName: 'information', value: e.information), + DataGridCell( + columnName: 'currentDiff', value: e.currentDiff), + DataGridCell(columnName: 'decimal', value: e.decimal), + DataGridCell(columnName: 'dayRight', value: e.dayRight), + ])) + .toList(); + } + + List booking = []; + + List _bookingDataGridRows = []; + + @override + List get rows => _bookingDataGridRows; + + @override + DataGridRowAdapter buildRow(DataGridRow row) { + return DataGridRowAdapter( + cells: row.getCells().map((e) { + return Container( + alignment: Alignment.center, + padding: const EdgeInsets.all(8.0), + child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()), + ); + }).toList()); + } + + void updateDataGrid() { + notifyListeners(); + } +} diff --git a/lib/data/publicHolidays.dart b/lib/data/publicHolidays.dart new file mode 100644 index 0000000..b5226bf --- /dev/null +++ b/lib/data/publicHolidays.dart @@ -0,0 +1,135 @@ +import 'package:jiffy/jiffy.dart'; + +class PublicHolidays { + PublicHolidays({ + required this.year, + }) { + holidayList[neujahr()] = 'Neujahr'; + holidayList[heilige3koenige()] = 'Heilige 3 Könige'; + holidayList[karfreitag()] = 'Karfreitag'; + holidayList[ostersonntag()] = 'Ostersonntag'; + holidayList[ostermontag()] = 'OsterMontag'; + holidayList[staatsfeiertag1()] = 'Staatsfeiertag'; + holidayList[christihimmelfahrt()] = 'Christi Himmelfahrt'; + holidayList[pfingstsonntag()] = 'Pfingstsonntag'; + holidayList[pfingstmontag()] = 'Pfingstmontag'; + holidayList[fronleichnam()] = 'Fronleichnam'; + holidayList[mariahimmelfahrt()] = 'Maria Himmelfahrt'; + holidayList[staatsfeiertag()] = 'Staatsfeiertag'; + holidayList[allerheiligen()] = 'Allerheiligen'; + holidayList[ersteradvent()] = '1. Advent'; + holidayList[mariaempfaengnis()] = 'Maria Emphängnis'; + holidayList[ersterweihnachtstag()] = '1. Weihnachtstag'; + holidayList[zweiterweihnachtstag()] = '2. Weihnachtstag'; + holidayList[silvester()] = 'Silvester'; + } + + Map holidayList = {}; + int year = 0; + + Map entries() { + return holidayList; + } + + String holiday(DateTime bookingDate) { + if (holidayList.containsKey(bookingDate)) { + return holidayList[bookingDate]!; + } + + return ''; + } + + DateTime neujahr() { + return DateTime(year, 1, 1); + } + + DateTime heilige3koenige() { + return DateTime(year, 1, 6); + } + + DateTime karfreitag() { + DateTime d = + Jiffy.parseFromDateTime(ostersonntag()).subtract(days: 2).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime ostersonntag() { + int a = year % 19; + int b = (year ~/ 100).toInt(); + int c = year % 100; + int e = b % 4; + int f = ((b + 8) ~/ 25).toInt(); + int g = ((b - f + 1) ~/ 3).toInt(); + int h = (19 * a + b - (b ~/ 4) - g + 15) % 30; + int k = c % 4; + int l = (32 + 2 * e + 2 * (c ~/ 4) - h - k) % 7; + int m = (a + 11 * h + 22 * l) ~/ 451; + int month = (h + l - 7 * m + 114) ~/ 31; + int day = (h + l - 7 * m + 114) % 31 + 1; + + return DateTime(year, month, day); + } + + DateTime ostermontag() { + DateTime d = Jiffy.parseFromDateTime(ostersonntag()).add(days: 1).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime staatsfeiertag1() { + return DateTime(year, 5, 1); + } + + DateTime christihimmelfahrt() { + DateTime d = Jiffy.parseFromDateTime(ostersonntag()).add(days: 39).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime pfingstsonntag() { + DateTime d = Jiffy.parseFromDateTime(ostersonntag()).add(days: 49).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime pfingstmontag() { + DateTime d = Jiffy.parseFromDateTime(ostersonntag()).add(days: 50).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime fronleichnam() { + DateTime d = Jiffy.parseFromDateTime(ostersonntag()).add(days: 60).dateTime; + return DateTime(d.year, d.month, d.day); + } + + DateTime mariahimmelfahrt() { + return DateTime(year, 8, 15); + } + + DateTime staatsfeiertag() { + return DateTime(year, 10, 26); + } + + DateTime allerheiligen() { + return DateTime(year, 11, 1); + } + + DateTime ersteradvent() { + DateTime d = DateTime(year, 11, 27); + DateTime d1 = Jiffy.parseFromDateTime(d).add(days: 7 - d.weekday).dateTime; + return DateTime(d1.year, d1.month, d1.day); + } + + DateTime mariaempfaengnis() { + return DateTime(year, 12, 8); + } + + DateTime ersterweihnachtstag() { + return DateTime(year, 12, 25); + } + + DateTime zweiterweihnachtstag() { + return DateTime(year, 12, 26); + } + + DateTime silvester() { + return DateTime(year, 12, 31); + } +} diff --git a/lib/main.dart b/lib/main.dart index 8e94089..6b4d1ee 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,125 +1,64 @@ import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:google_fonts/google_fonts.dart'; -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // TRY THIS: Try running your application with "flutter run". You'll see - // the application has a purple toolbar. Then, without quitting the app, - // try changing the seedColor in the colorScheme below to Colors.green - // and then invoke "hot reload" (save your changes or press the "hot - // reload" button in a Flutter-supported IDE, or press "r" if you used - // the command line to start the app). - // - // Notice that the counter didn't reset back to zero; the application - // state is not lost during the reload. To reset the state, use hot - // restart instead. - // - // This works for code too, not just values: Most code changes can be - // tested with just a hot reload. - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} +import 'package:workinghours/widgets/tabsScreen.dart'; -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); +final theme = ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.dark, + seedColor: const Color.fromARGB(255, 131, 57, 0), + ), + textTheme: GoogleFonts.latoTextTheme(), +); - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + SharedPreferences prefs = await SharedPreferences.getInstance(); - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". + String? dbProtocol = prefs.getString('dbProtocol'); + String? dbHost = prefs.getString('dbHost'); + String? dbPath = prefs.getString('dbPath'); + String? dbUser = prefs.getString('dbUser'); + String? dbPassword = prefs.getString('dbPassword'); - final String title; + // if (dbProtocol == null) { + //prefs.setString('dbProtocol', 'http'); + prefs.setString('dbProtocol', 'https'); + // } + // if (dbHost == null) { + //prefs.setString('dbHost', '192.168.0.70'); + prefs.setString('dbHost', 'api.windesign.at'); + // } + // if (dbProtocol == null) { + // prefs.setString('dbProtocol', 'https'); + // } + // if (dbHost == null) { + // prefs.setString('dbHost', 'api.windesign.at'); + // } + if (dbPath == null) { + prefs.setString('dbPath', '/workinghours.php'); + } + if (dbUser == null) { + prefs.setString('dbUser', ''); + } + if (dbPassword == null) { + prefs.setString('dbPassword', ''); + } - @override - State createState() => _MyHomePageState(); + runApp(const MyApp()); } -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } +class MyApp extends StatelessWidget { + const MyApp({super.key}); @override Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // TRY THIS: Try changing the color here to a specific color (to - // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar - // change color while the other colors stay the same. - backgroundColor: Theme.of(context).colorScheme.inversePrimary, - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - // - // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" - // action in the IDE, or press "p" in the console), to see the - // wireframe for each widget. - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. + return MaterialApp( +// theme: theme, + title: 'Multimedia', + home: const TabsScreen(), ); } } diff --git a/lib/widgets/monthly/monthlyScreen.dart b/lib/widgets/monthly/monthlyScreen.dart new file mode 100644 index 0000000..b73bd4c --- /dev/null +++ b/lib/widgets/monthly/monthlyScreen.dart @@ -0,0 +1,268 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +import 'package:syncfusion_flutter_datagrid/datagrid.dart'; +import 'package:syncfusion_flutter_core/theme.dart'; + +import 'package:jiffy/jiffy.dart'; + +import 'package:workinghours/data/publicHolidays.dart'; +import 'package:workinghours/data/booking.dart'; + +class MonthlyScreen extends StatefulWidget { + const MonthlyScreen({ + super.key, + }); + + @override + State createState() => _MonthlyScreenState(); +} + +class _MonthlyScreenState extends State { + final DataGridController _dataGridController = DataGridController(); + late BookingDataSource bookingDataSource; + List _columns = []; + + Future> generateBookingList() async { + // SharedPreferences prefs = await SharedPreferences.getInstance(); + + // String? dbProtocol = prefs.getString('dbProtocol'); + // String? dbHost = prefs.getString('dbHost'); + // String? dbPath = prefs.getString('dbPath'); + + // Uri url = Uri( + // scheme: dbProtocol, + // host: dbHost, + // path: dbPath, + // queryParameters: { + // 'module': 'movie', + // 'function': 'getList', + // }, + // ); + + // final response = await http.get(url); + // bool? error; + // String? errorMessage; + + // Map movies = json.decode(response.body); + // error = movies['error']; + // errorMessage = movies['errmsg']; + // var list = movies['data']; + + // List _movies = + // await list.map((json) => Movie.fromJson(json)).toList(); + // movieDataSource = MovieDataSource(_movies); + // return _movies; + + List _booking = []; + + for (int i = 1; i < 31; i++) { + _booking.add(Booking( + bookingDay: DateTime(2024, 1, i), + come1: DateTime(2024, 1, i, 8, 3, 0), + leave1: DateTime(2024, 1, i, 16, 27, 0), + come2: DateTime(1900, 1, 1), + leave2: DateTime(1900, 1, 1), + come3: DateTime(1900, 1, 1), + leave3: DateTime(1900, 1, 1), + come4: DateTime(1900, 1, 1), + leave4: DateTime(1900, 1, 1), + come5: DateTime(1900, 1, 1), + leave5: DateTime(1900, 1, 1), + code: '', + information: '', + )); + } + bookingDataSource = BookingDataSource(_booking); + return _booking; + } + + List getColumns() { + return [ + GridColumn( + columnName: 'dayLeft', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(16.0), + alignment: Alignment.centerLeft, + child: const Text('dayLeft'))), + GridColumn( + columnName: 'holiday', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(16.0), + alignment: Alignment.centerLeft, + child: const Text('holiday'))), + GridColumn( + columnName: 'come1', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('come1'))), + GridColumn( + columnName: 'leave1', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('leave1'))), + GridColumn( + columnName: 'come2', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('come2'))), + GridColumn( + columnName: 'leave2', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('leave2'))), + GridColumn( + columnName: 'come3', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('come3'))), + GridColumn( + columnName: 'leave3', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('leave3'))), + GridColumn( + columnName: 'come4', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('come4'))), + GridColumn( + columnName: 'leave4', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('leave4'))), + GridColumn( + columnName: 'come5', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('come5'))), + GridColumn( + columnName: 'leave5', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('leave5'))), + GridColumn( + columnName: 'pause', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('pause'))), + GridColumn( + columnName: 'code', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('code'))), + GridColumn( + columnName: 'durationIs', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('durationIs'))), + GridColumn( + columnName: 'durationShould', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('durationShould'))), + GridColumn( + columnName: 'diff', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('diff'))), + GridColumn( + columnName: 'information', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('information'))), + GridColumn( + columnName: 'currentDiff', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('currentDiff'))), + GridColumn( + columnName: 'decimal', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('decimal'))), + GridColumn( + columnName: 'dayRight', + columnWidthMode: ColumnWidthMode.auto, + label: Container( + padding: const EdgeInsets.all(8.0), + alignment: Alignment.centerLeft, + child: const Text('dayRight'))), + ]; + } + + @override + void initState() { + super.initState(); + _columns = getColumns(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: FutureBuilder( + future: generateBookingList(), + builder: (context, data) { + return data.hasData + ? SfDataGridTheme( + data: const SfDataGridThemeData( + headerColor: Color(0xff009889), + ), + child: SfDataGrid( + source: bookingDataSource, + selectionMode: SelectionMode.single, + navigationMode: GridNavigationMode.row, + columns: _columns, + controller: _dataGridController, + columnWidthMode: ColumnWidthMode.auto, + ), + ) + : const Center( + child: CircularProgressIndicator( + strokeWidth: 2, + value: 0.8, + ), + ); + }, + ), + ); + } +} diff --git a/lib/widgets/tabsScreen.dart b/lib/widgets/tabsScreen.dart new file mode 100644 index 0000000..41489e1 --- /dev/null +++ b/lib/widgets/tabsScreen.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; + +import 'package:workinghours/widgets/monthly/monthlyScreen.dart'; +import 'package:workinghours/widgets/yearly/yearlyScreen.dart'; + +class TabsScreen extends StatefulWidget { + const TabsScreen({super.key}); + + @override + State createState() { + return _TabsScreenState(); + } +} + +class _TabsScreenState extends State { + @override + void initState() { + super.initState(); + } + + int _selectedPageIndex = 0; + + void _selectPage(int index) { + setState(() { + _selectedPageIndex = index; + }); + } + + @override + Widget build(BuildContext context) { + Widget activePage = const MonthlyScreen(); + var activePageTitle = 'Monthly'; + + if (_selectedPageIndex == 1) { + activePage = const YearlyScreen(); + activePageTitle = 'Yearly'; + } + + return Scaffold( + appBar: AppBar( + title: Text(activePageTitle), + ), + body: activePage, + bottomNavigationBar: BottomNavigationBar( + onTap: _selectPage, + currentIndex: _selectedPageIndex, + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.home), +// icon: Icon(Icons.tv_outlined), + label: 'Monthly', + ), + BottomNavigationBarItem( + icon: Icon(Icons.business), +// icon: Icon(Icons.movie), + label: 'Yearly', + ), + ], + selectedIconTheme: const IconThemeData(opacity: 0.0, size: 0), + unselectedIconTheme: const IconThemeData(opacity: 0.0, size: 0), + ), + ); + } +} diff --git a/lib/widgets/yearly/yearlyScreen.dart b/lib/widgets/yearly/yearlyScreen.dart new file mode 100644 index 0000000..ef3911a --- /dev/null +++ b/lib/widgets/yearly/yearlyScreen.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class YearlyScreen extends StatefulWidget { + const YearlyScreen({ + super.key, + }); + + @override + State createState() => _YearlyScreenState(); +} + +class _YearlyScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Text('bla'), + ), + ); + } +} diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..b8e2b22 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import path_provider_foundation +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index d11b7e5..1a71527 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" cupertino_icons: dependency: "direct main" description: @@ -57,6 +65,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -75,6 +99,51 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 + url: "https://pub.dev" + source: hosted + version: "6.2.1" + http: + dependency: "direct main" + description: + name: http + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + jiffy: + dependency: "direct main" + description: + name: jiffy + sha256: b09b6aacc0ebe7d178d2fcbabfd73e7d3340594043fe949bb7e0814093b00201 + url: "https://pub.dev" + source: hosted + version: "6.3.0" leak_tracker: dependency: transitive description: @@ -139,6 +208,126 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + url: "https://pub.dev" + source: hosted + version: "2.2.4" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180 + url: "https://pub.dev" + source: hosted + version: "2.2.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + url: "https://pub.dev" + source: hosted + version: "2.3.5" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + url: "https://pub.dev" + source: hosted + version: "2.3.2" sky_engine: dependency: transitive description: flutter @@ -176,6 +365,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + syncfusion_flutter_core: + dependency: "direct main" + description: + name: syncfusion_flutter_core + sha256: "8e19260d292ed77e1cbd4ee1baafb3c9486079cad856e7891478131d25076039" + url: "https://pub.dev" + source: hosted + version: "25.1.40" + syncfusion_flutter_datagrid: + dependency: "direct main" + description: + name: syncfusion_flutter_datagrid + sha256: "3146b5a1a2833aa0834582b183ffd1fe5380b03581533cf772b54677a31ff254" + url: "https://pub.dev" + source: hosted + version: "25.1.40" term_glyph: dependency: transitive description: @@ -192,6 +397,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.1" + transparent_image: + dependency: "direct main" + description: + name: transparent_image + sha256: e8991d955a2094e197ca24c645efec2faf4285772a4746126ca12875e54ca02f + url: "https://pub.dev" + source: hosted + version: "2.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" vector_math: dependency: transitive description: @@ -208,5 +429,30 @@ packages: url: "https://pub.dev" source: hosted version: "13.0.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a" + url: "https://pub.dev" + source: hosted + version: "5.4.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" sdks: - dart: ">=3.3.2 <4.0.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.2" diff --git a/pubspec.yaml b/pubspec.yaml index f4c2735..0c71955 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,6 @@ name: workinghours -description: "A new Flutter project." +description: A new Flutter project. + # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev @@ -19,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.3.2 <4.0.0' + sdk: '>=3.2.6 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -34,7 +35,15 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.6 + cupertino_icons: ^1.0.2 + http: ^1.2.0 + syncfusion_flutter_datagrid: ^25.1.37 + intl: ^0.19.0 + syncfusion_flutter_core: ^25.1.37 + google_fonts: ^6.2.1 + shared_preferences: ^2.2.2 + transparent_image: ^2.0.1 + jiffy: ^6.1.0 dev_dependencies: flutter_test: @@ -45,7 +54,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^3.0.0 + flutter_lints: ^3.0.2 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -60,6 +69,7 @@ flutter: # To add assets to your application, add an assets section, like this: # assets: + # - assets/cfg/config.json # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg @@ -88,3 +98,8 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages + #fonts: + # - family: geometric + # fonts: + # - asset: assets/fonts/geometric.ttf + # style: normal \ No newline at end of file