diff --git a/.metadata b/.metadata index cf4b47a..039e37d 100644 --- a/.metadata +++ b/.metadata @@ -15,21 +15,6 @@ migration: - platform: root create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - - platform: android - create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - - platform: ios - create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - - platform: linux - create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - - platform: macos - create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - - platform: web - create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 - platform: windows create_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 base_revision: c9a6c484230f8b5e408ec57be1ef71dee1e77020 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..001bbe6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Flutter Web Debug", + "request": "launch", + "type": "dart", + "flutterMode": "debug", + "args": [ + "--web-hostname=localhost", + "--web-port=8080" + ] + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d7d77e9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.sourceDirectory": "C:/Developement/FlutterFirma/flutter_test_services/windows" +} \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d29021..45d4309 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,6 +7,9 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. +analyzer: + errors: + avoid_print: warning include: package:flutter_lints/flutter.yaml linter: @@ -21,7 +24,7 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule + avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at diff --git a/assets/images/AskiDashboard.png b/assets/images/AskiDashboard.png new file mode 100644 index 0000000..8111d48 Binary files /dev/null and b/assets/images/AskiDashboard.png differ diff --git a/assets/images/AskiLannach.png b/assets/images/AskiLannach.png new file mode 100644 index 0000000..6a1c101 Binary files /dev/null and b/assets/images/AskiLannach.png differ diff --git a/assets/images/AskiSarleinsbach.png b/assets/images/AskiSarleinsbach.png new file mode 100644 index 0000000..bb4cfe5 Binary files /dev/null and b/assets/images/AskiSarleinsbach.png differ diff --git a/assets/images/AskiTraun.png b/assets/images/AskiTraun.png new file mode 100644 index 0000000..9d922f9 Binary files /dev/null and b/assets/images/AskiTraun.png differ diff --git a/lib/controller/home_controller.dart b/lib/controller/home_controller.dart new file mode 100644 index 0000000..1da1f48 --- /dev/null +++ b/lib/controller/home_controller.dart @@ -0,0 +1,148 @@ +import 'package:get/get.dart'; +import 'package:flutter/material.dart'; +import 'package:get_storage/get_storage.dart'; + +import '../helper/constants.dart'; + +enum MainView { dashboard, traun, sarleinsbach, lannach, settings } + +class HomeController extends GetxController { + // Der Key, mit dem wir das Scaffold von hier aus steuern + final GlobalKey scaffoldKey = GlobalKey(); + + final boxSettings = GetStorage(); + final currentView = MainView.dashboard.obs; + + //--------------Settings View--------------------------- + final askiUserController = TextEditingController().obs; + final askiPasswordController = TextEditingController().obs; + final loginUrlController = TextEditingController().obs; + final powerUrlController = TextEditingController().obs; + + final pvTraunDeviceController = TextEditingController().obs; + final pvTraunDeviceMeterIdPVController = TextEditingController().obs; + final pvTraunDeviceMeterIdImportController = TextEditingController().obs; + + final pvSarleinsbachDeviceController = TextEditingController().obs; + final pvSarleinsbachDeviceMeterIdPV01Controller = TextEditingController().obs; + final pvSarleinsbachDeviceMeterIdPV02Controller = TextEditingController().obs; + final pvSarleinsbachDeviceMeterIdPV03Controller = TextEditingController().obs; + final pvSarleinsbachDeviceMeterIdImportController = TextEditingController().obs; + + final pvLannachDeviceController = TextEditingController().obs; + final pvLannachDeviceMeterIdPVController = TextEditingController().obs; + final pvLannachDeviceMeterIdImportController = TextEditingController().obs; + + void saveSettings() { + String askiUser = askiUserController.value.text; + String askiPassword = askiPasswordController.value.text; + String loginUrl = loginUrlController.value.text; + String powerUrl = powerUrlController.value.text; + //traun + String pvTraunDevice = pvTraunDeviceController.value.text; + int pvTraunDeviceMeterIdPV = int.parse(pvTraunDeviceMeterIdPVController.value.text); + int pvTraunDeviceMeterIdImport = int.parse(pvTraunDeviceMeterIdImportController.value.text); + //sarleinsbach + String pvSarleinsbachDevice = pvSarleinsbachDeviceController.value.text; + int pvSarleinsbachDeviceMeterIdPV01 = int.parse(pvSarleinsbachDeviceMeterIdPV01Controller.value.text); + int pvSarleinsbachDeviceMeterIdPV02 = int.parse(pvSarleinsbachDeviceMeterIdPV02Controller.value.text); + int pvSarleinsbachDeviceMeterIdPV03 = int.parse(pvSarleinsbachDeviceMeterIdPV03Controller.value.text); + int pvSarleinsbachDeviceMeterIdImport = int.parse(pvSarleinsbachDeviceMeterIdImportController.value.text); + //lannach + String pvLannachDevice = pvLannachDeviceController.value.text; + int pvLannachDeviceMeterIdPV = int.parse(pvLannachDeviceMeterIdPVController.value.text); + int pvLannachDeviceMeterIdImport = int.parse(pvLannachDeviceMeterIdImportController.value.text); + + + boxSettings.write('askiUser', askiUser); + boxSettings.write('askiPassword', askiPassword); + boxSettings.write('loginUrl', loginUrl); + boxSettings.write('powerUrl', powerUrl); + boxSettings.write('pvTraunDevice', pvTraunDevice); + boxSettings.write('pvTraunDeviceMeterIdPV', pvTraunDeviceMeterIdPV); + boxSettings.write('pvTraunDeviceMeterIdImport', pvTraunDeviceMeterIdImport); + boxSettings.write('pvSarleinsbachDevice', pvSarleinsbachDevice); + boxSettings.write('pvSarleinsbachDeviceMeterIdPV01', pvSarleinsbachDeviceMeterIdPV01); + boxSettings.write('pvSarleinsbachDeviceMeterIdPV02', pvSarleinsbachDeviceMeterIdPV02); + boxSettings.write('pvSarleinsbachDeviceMeterIdPV03', pvSarleinsbachDeviceMeterIdPV03); + boxSettings.write('pvSarleinsbachDeviceMeterIdImport', pvSarleinsbachDeviceMeterIdImport); + boxSettings.write('pvLannachDevice', pvLannachDevice); + boxSettings.write('pvLannachDeviceMeterIdPV', pvLannachDeviceMeterIdPV); + boxSettings.write('pvLannachDeviceMeterIdImport', pvLannachDeviceMeterIdImport); + + kDisplaySnackBarGreen("Settings saved successfully!"); + + print('Einstellungen gespeichert:'); + print('ASKI User: $askiUser'); + print('ASKI Password: $askiPassword'); + print('Login URL: $loginUrl'); + print('Power URL: $powerUrl'); + } + //------------------------------------------------------ + + void changeView(MainView view) { + currentView.value = view; + } + + void toggleDrawer() { + final ScaffoldState? state = scaffoldKey.currentState; + + if (state != null) { + if (state.isDrawerOpen) { + print("Schließe Drawer..."); + state.closeDrawer(); // Wartet auf das Ende der Schließ-Animation + print("Drawer geschlossen."); + } else { + print("Öffne Drawer..."); + state.openDrawer(); // Wartet auf das Ende der Öffnen-Animation + print("Drawer geöffnet."); + } + } + } + + @override + void onInit() { + super.onInit(); + _readStorageData(); + } + + void _readStorageData() { + bool hasAskiUser = boxSettings.hasData('askiUser'); + if (hasAskiUser) { + askiUserController.value.text = boxSettings.read('askiUser'); + } + bool hasAskiPassword = boxSettings.hasData('askiPassword'); + if (hasAskiPassword) { + askiPasswordController.value.text = boxSettings.read('askiPassword'); + } + bool hasLoginUrl = boxSettings.hasData('loginUrl'); + if (hasLoginUrl) { + loginUrlController.value.text = boxSettings.read('loginUrl'); + } + bool hasPowerUrl = boxSettings.hasData('powerUrl'); + if (hasPowerUrl) { + powerUrlController.value.text = boxSettings.read('powerUrl'); + } + } + + @override + void onClose() { + askiUserController.close(); + askiPasswordController.close(); + loginUrlController.close(); + powerUrlController.close(); + pvTraunDeviceController.close(); + pvTraunDeviceMeterIdPVController.close(); + pvTraunDeviceMeterIdImportController.close(); + pvSarleinsbachDeviceController.close(); + pvSarleinsbachDeviceMeterIdPV01Controller.close(); + pvSarleinsbachDeviceMeterIdPV02Controller.close(); + pvSarleinsbachDeviceMeterIdPV03Controller.close(); + pvSarleinsbachDeviceMeterIdImportController.close(); + pvLannachDeviceController.close(); + pvLannachDeviceMeterIdPVController.close(); + pvLannachDeviceMeterIdImportController.close(); + super.onClose(); + } + +} diff --git a/lib/helper/constants.dart b/lib/helper/constants.dart new file mode 100644 index 0000000..12ea761 --- /dev/null +++ b/lib/helper/constants.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +var kFontSizeDouble = 15.0; + +var kTextSyleLittleGrey = + TextStyle(fontSize: 12.0, color: Colors.grey.shade800); + +var kTextSyleHeaderGrey = + TextStyle(fontSize: 25.0, color: Colors.grey.shade800); + +var kElevatetButtonStyleDrawer = ElevatedButton.styleFrom( + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold), +); + +//DropDown Styles +var kInputDecorationDropDownMenue = InputDecoration( + //prefixIcon: Icon(Icons.date_range), + hintText: 'User'.toUpperCase(), + contentPadding: const EdgeInsets.all(10), + hintStyle: TextStyle(letterSpacing: 2, fontSize: kFontSizeDouble), + filled: true, + fillColor: Colors.grey.shade400, + errorStyle: const TextStyle(color: Colors.yellow), +); + +SnackbarController kDisplaySnackBarRed(String szInfoText) { + return Get.snackbar('Info', szInfoText, + backgroundColor: Colors.red[600], + snackPosition: SnackPosition.TOP, + colorText: Colors.white, + snackStyle: SnackStyle.GROUNDED); +} + +SnackbarController kDisplaySnackBarGreen(String szInfoText) { + return Get.snackbar('Info', szInfoText, + backgroundColor: Colors.green[600], + snackPosition: SnackPosition.TOP, + colorText: Colors.black, + snackStyle: SnackStyle.GROUNDED); +} + +//Setting Wait for Delete +List> kListMapSetting = [ + {'ContainerID': '', 'Info': ''} +]; + +//Switching PROD/DEV +String kStringEnvironment = '?'; + +Future kShowPopupDialog( + String title, + String content, + String buttonLeftText, + String buttonRightText, +) async { + return await Get.dialog( + AlertDialog( + title: Text(title), + content: Text(content), + actions: [ + TextButton( + onPressed: () { + Navigator.of(Get.overlayContext!).pop('Abbrechen'); + }, + child: Text(buttonLeftText), + ), + TextButton( + onPressed: () { + Navigator.of(Get.overlayContext!).pop('OK'); + }, + child: Text(buttonRightText), + ), + ], + ), + ); +} diff --git a/lib/helper/http_overrides.dart b/lib/helper/http_overrides.dart new file mode 100644 index 0000000..36ccf39 --- /dev/null +++ b/lib/helper/http_overrides.dart @@ -0,0 +1,10 @@ +import 'dart:io'; + +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context) + ..badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + } +} diff --git a/lib/helper/sample_bindings.dart b/lib/helper/sample_bindings.dart new file mode 100644 index 0000000..5a11f55 --- /dev/null +++ b/lib/helper/sample_bindings.dart @@ -0,0 +1,11 @@ + + +import 'package:get/get.dart'; +import '../controller/home_controller.dart'; + +class SampleBindings extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => HomeController()); + } +} diff --git a/lib/helper/sample_routes.dart b/lib/helper/sample_routes.dart new file mode 100644 index 0000000..34cec80 --- /dev/null +++ b/lib/helper/sample_routes.dart @@ -0,0 +1,16 @@ +import 'package:get/get.dart'; + +import '../pages/home/home_view.dart'; +import './sample_bindings.dart'; + +class SampleRouts { + static final sampleBindings = SampleBindings(); + static final samplePages = [ + GetPage( + name: HomePage.routeName, + binding: sampleBindings, + page: () => const HomePage(), + transition: Transition.leftToRight, + ), + ]; +} diff --git a/lib/main.dart b/lib/main.dart index 244a702..6798ac7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,18 @@ -import 'package:flutter/material.dart'; -void main() { +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; + +import 'helper/http_overrides.dart'; +import 'helper/sample_routes.dart'; +import 'pages/home/home_view.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await GetStorage.init(); + HttpOverrides.global = MyHttpOverrides(); runApp(const MyApp()); } @@ -10,113 +22,15 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( + return GetMaterialApp( title: 'Flutter Demo', + debugShowCheckedModeBanner: false, 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: .fromSeed(seedColor: Colors.deepPurple), - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - // 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. - - // 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". - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -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++; - }); - } - - @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: .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), + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueGrey), ), + + initialRoute: HomePage.routeName, + getPages: SampleRouts.samplePages, ); } } diff --git a/lib/models/home_model.dart b/lib/models/home_model.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/pages/home/home_view.dart b/lib/pages/home/home_view.dart new file mode 100644 index 0000000..dade4dd --- /dev/null +++ b/lib/pages/home/home_view.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../controller/home_controller.dart'; +import '../../widgets/drawer_widget.dart'; +import '../../widgets/views/dashboard.dart'; +import '../../widgets/views/lannach.dart'; +import '../../widgets/views/sarleinsbach.dart'; +import '../../widgets/views/settings.dart'; +import '../../widgets/views/traun.dart'; + +class HomePage extends GetView { + static const String routeName = '/home-page'; + const HomePage({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = controller; + return Scaffold( + appBar: AppBar( + title: const Text('ASKI Internorm Inside'), + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + toolbarHeight: 80, + iconTheme: const IconThemeData(size: 40, color: Colors.white), + titleTextStyle: const TextStyle(fontSize: 35, color: Colors.white), + ), + drawer: const Drawer(child: DrawerWidget()), + body: Container( + decoration: BoxDecoration( + color: Colors.grey[300] + ), + child: Obx(() { + switch (hCtrl.currentView.value) { + case MainView.dashboard: + return const DashboardView(); + case MainView.traun: + return const TraunView(); + case MainView.sarleinsbach: + return const SarleinsbachView(); + case MainView.lannach: + return const LannachView(); + case MainView.settings: + return const SettingsView(); + } + }), + ), + ); + } +} diff --git a/lib/widgets/drawer_widget.dart b/lib/widgets/drawer_widget.dart new file mode 100644 index 0000000..afd54dc --- /dev/null +++ b/lib/widgets/drawer_widget.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../controller/home_controller.dart'; +import '../helper/constants.dart'; +import './my_elevated_button_style_drawer.dart'; + +class DrawerWidget extends StatelessWidget { + const DrawerWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 30.0), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Drawer Widget', textAlign: TextAlign.center, style: kTextSyleHeaderGrey), + SizedBox(height: 50), + MyElevatedButtonStyleDrawer( + buttonText: 'Dashboard', + onPressed: () { + Get.find().changeView(MainView.dashboard); + Get.close(1); + }, + ), + SizedBox(height: 20), + MyElevatedButtonStyleDrawer( + buttonText: 'Traun', + onPressed: () { + Get.find().changeView(MainView.traun); + Get.close(1); + }, + ), + SizedBox(height: 20), + MyElevatedButtonStyleDrawer( + buttonText: 'Sarleinsbach', + onPressed: () { + Get.find().changeView(MainView.sarleinsbach); + Get.close(1); + }, + ), + SizedBox(height: 20), + MyElevatedButtonStyleDrawer( + buttonText: 'Lannach', + onPressed: () { + Get.find().changeView(MainView.lannach); + Get.close(1); + }, + ), + SizedBox(height: 60), + MyElevatedButtonStyleDrawer( + buttonText: 'Settings', + onPressed: () { + Get.find().changeView(MainView.settings); + Get.close(1); + }, + ), + SizedBox(height: 20), + SizedBox( + width: 200, + height: 40, + child: ElevatedButton( + style: kElevatetButtonStyleDrawer, + onPressed: () { + Get.close(1); + }, + child: Text('Close'), + ), + ), + ], + ), + ); + } +} + + diff --git a/lib/widgets/my_elevated_button_style_drawer.dart b/lib/widgets/my_elevated_button_style_drawer.dart new file mode 100644 index 0000000..dc10e4d --- /dev/null +++ b/lib/widgets/my_elevated_button_style_drawer.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import '../helper/constants.dart'; + +class MyElevatedButtonStyleDrawer extends StatelessWidget { + const MyElevatedButtonStyleDrawer({super.key, this.onPressed, required this.buttonText}); + + final void Function()? onPressed; + final String buttonText; + + + @override + Widget build(BuildContext context) { + return SizedBox( + width: 200, + height: 40, + child: ElevatedButton( + style: kElevatetButtonStyleDrawer, + onPressed: onPressed, + child: Text(buttonText), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/views/dashboard.dart b/lib/widgets/views/dashboard.dart new file mode 100644 index 0000000..6913844 --- /dev/null +++ b/lib/widgets/views/dashboard.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../controller/home_controller.dart'; + +class DashboardView extends StatelessWidget { + const DashboardView({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = Get.find(); + return Center( + child: Container( + margin: const EdgeInsets.all(20), + width: 1000, + child: Wrap( + spacing: 20, + runSpacing: 20, + children: [ + InkWell( + onTap: () { + hCtrl.changeView(MainView.dashboard); + }, + child: Image.asset('assets/images/AskiDashboard.png',width: 450), + ), + InkWell( + onTap: () { + hCtrl.changeView(MainView.traun); + }, + child: Image.asset('assets/images/AskiTraun.png',width: 450), + ), + InkWell( + onTap: () { + hCtrl.changeView(MainView.sarleinsbach); + }, + child: Image.asset('assets/images/AskiSarleinsbach.png',width: 450), + ), + InkWell( + onTap: () { + hCtrl.changeView(MainView.lannach); + }, + child: Image.asset('assets/images/AskiLannach.png',width: 450), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/views/lannach.dart b/lib/widgets/views/lannach.dart new file mode 100644 index 0000000..abf2447 --- /dev/null +++ b/lib/widgets/views/lannach.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../controller/home_controller.dart'; + +class LannachView extends StatelessWidget { + const LannachView({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = Get.find(); + return Scaffold( + appBar: AppBar( + title: const Text('PV Lannach'), + centerTitle: true, + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + titleTextStyle: const TextStyle(fontSize: 30, color: Colors.white), + iconTheme: const IconThemeData(size: 30, color: Colors.white), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + hCtrl.changeView(MainView.dashboard); + }, + ) + ), + body: const Center( + child: Text( + "PV Lannach", + style: TextStyle(fontSize: 30), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/views/sarleinsbach.dart b/lib/widgets/views/sarleinsbach.dart new file mode 100644 index 0000000..ca916b0 --- /dev/null +++ b/lib/widgets/views/sarleinsbach.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../controller/home_controller.dart'; + +class SarleinsbachView extends StatelessWidget { + const SarleinsbachView({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = Get.find(); + return Scaffold( + appBar: AppBar( + title: const Text('PV Sarleinsbach'), + centerTitle: true, + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + titleTextStyle: const TextStyle(fontSize: 30, color: Colors.white), + iconTheme: const IconThemeData(size: 30, color: Colors.white), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + hCtrl.changeView(MainView.dashboard); + }, + ) + ), + body: const Center( + child: Text( + "PV Sarleinsbach", + style: TextStyle(fontSize: 30), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/views/settings.dart b/lib/widgets/views/settings.dart new file mode 100644 index 0000000..0811d0f --- /dev/null +++ b/lib/widgets/views/settings.dart @@ -0,0 +1,108 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../controller/home_controller.dart'; + +class SettingsView extends StatelessWidget { + const SettingsView({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = Get.find(); + return Scaffold( + appBar: AppBar( + title: const Text('Data Settings'), + centerTitle: true, + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + titleTextStyle: const TextStyle(fontSize: 30, color: Colors.white), + iconTheme: const IconThemeData(size: 30, color: Colors.white), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + hCtrl.changeView(MainView.dashboard); + }, + ), + actions: [ + IconButton( + icon: const Icon(Icons.save), + onPressed: () { + // Save the login URL to the controller + hCtrl.saveSettings(); + }, + ), + ], + ), + body: Padding( + padding: const EdgeInsets.all(18.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 10), + Text( + "Please enter User and Password", + style: TextStyle(fontSize: 18), + ), + SizedBox(height: 10), + TextField( + controller: hCtrl.askiUserController.value, + decoration: InputDecoration( + labelText: 'Input User', + border: OutlineInputBorder(), + hintText: 'Enter ASKI User', + ), + ), + SizedBox(height: 10), + TextField( + controller: hCtrl.askiPasswordController.value, + obscureText: true, + decoration: InputDecoration( + labelText: 'Input Password', + border: OutlineInputBorder(), + hintText: 'Enter ASKI Password', + ), + ), + SizedBox(height: 10), + Text( + "Please enter the URLs for the ASKI login and power data", + style: TextStyle(fontSize: 18), + ), + SizedBox(height: 10), + TextField( + controller: hCtrl.loginUrlController.value, + decoration: InputDecoration( + labelText: 'Login URL', + border: OutlineInputBorder(), + hintText: 'Enter ASKI Login URL', + ), + ), + SizedBox(height: 10), + TextField( + controller: hCtrl.powerUrlController.value, + decoration: InputDecoration( + labelText: 'Power URL', + border: OutlineInputBorder(), + hintText: 'Enter ASKI Power URL', + ), + ), + SizedBox(height: 10), + Text( + "Please enter the device for PV Traun and PV Sarleinsbach and PV Lannach", + style: TextStyle(fontSize: 18), + ), + SizedBox(height: 10), + TextField( + controller: hCtrl.pvTraunDeviceController.value, + decoration: InputDecoration( + labelText: 'PV Traun Device', + border: OutlineInputBorder(), + hintText: 'Enter PV Traun Device', + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/views/traun.dart b/lib/widgets/views/traun.dart new file mode 100644 index 0000000..16a6437 --- /dev/null +++ b/lib/widgets/views/traun.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import '../../controller/home_controller.dart'; + +class TraunView extends StatelessWidget { + const TraunView({super.key}); + + @override + Widget build(BuildContext context) { + var hCtrl = Get.find(); + return Scaffold( + appBar: AppBar( + title: const Text('PV Traun'), + centerTitle: true, + backgroundColor: Colors.blueGrey, + foregroundColor: Colors.white, + titleTextStyle: const TextStyle(fontSize: 30, color: Colors.white), + iconTheme: const IconThemeData(size: 30, color: Colors.white), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + hCtrl.changeView(MainView.dashboard); + }, + ) + ), + body: const Center( + child: Text( + "PV Traun", + style: TextStyle(fontSize: 30), + ), + ), + ); + } +} \ No newline at end of file diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..be1ee3e 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/pubspec.lock b/pubspec.lock index 582d01a..8d12e21 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" async: dependency: transitive description: @@ -33,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" collection: dependency: transitive description: @@ -41,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" cupertino_icons: dependency: "direct main" description: @@ -57,6 +81,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" flutter: dependency: "direct main" description: flutter @@ -75,6 +107,54 @@ packages: description: flutter source: sdk version: "0.0.0" + get: + dependency: "direct main" + description: + name: get + sha256: "5ed34a7925b85336e15d472cc4cfe7d9ebf4ab8e8b9f688585bf6b50f4c3d79a" + url: "https://pub.dev" + source: hosted + version: "4.7.3" + get_storage: + dependency: "direct main" + description: + name: get_storage + sha256: "39db1fffe779d0c22b3a744376e86febe4ade43bf65e06eab5af707dc84185a2" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + hooks: + dependency: transitive + description: + name: hooks + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" leak_tracker: dependency: transitive description: @@ -107,6 +187,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" matcher: dependency: transitive description: @@ -131,6 +219,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed" + url: "https://pub.dev" + source: hosted + version: "9.4.1" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" path: dependency: transitive description: @@ -139,6 +243,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" sky_engine: dependency: transitive description: flutter @@ -192,6 +376,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.11" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" vector_math: dependency: transitive description: @@ -208,6 +400,30 @@ packages: url: "https://pub.dev" source: hosted version: "15.2.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" sdks: dart: ">=3.12.2 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.38.4" diff --git a/pubspec.yaml b/pubspec.yaml index e016dbd..d7e96f9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,89 +1,29 @@ name: flutter_test_services 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 -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. +publish_to: "none" + version: 1.0.0+1 environment: sdk: ^3.12.2 -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: + cupertino_icons: ^1.0.8 flutter: sdk: flutter - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.8 + get: ^4.7.3 + get_storage: ^2.1.1 + intl: ^0.20.3 dev_dependencies: + flutter_lints: ^6.0.0 flutter_test: sdk: flutter - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # 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: ^6.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/to/resolution-aware-images - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/to/asset-from-package - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/to/font-from-package + assets: + - assets/images/ + - assets/icons/ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..3ad69c6 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni ) set(PLUGIN_BUNDLED_LIBRARIES)