diff --git a/.github/workflows/flutter-apkBuild.yml b/.github/workflows/flutter-apkBuild.yml new file mode 100644 index 0000000..da47a8f --- /dev/null +++ b/.github/workflows/flutter-apkBuild.yml @@ -0,0 +1,58 @@ +name: "[FLUTTER] APK Create" +run-name: "[FLUTTER] APK Create : ${{ github.actor }} push '${{ github.event.head_commit.message }}' 🚀" +on: + push: + paths: + - client_flutter/** +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.4.0 + - uses: actions/setup-java@v3.10.0 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '11' + - uses: subosito/flutter-action@v2.8.0 + with: + flutter-version: '3.13.2' + channel: stable + - name: Create env file + working-directory: ./client_flutter + run: | + touch .env + echo BASEURL=${{ secrets.API_BASEURL }} >> .env + echo MODE=DEV >> .env + cat .env + ls -a + - name: get package + working-directory: ./client_flutter + run: | + flutter pub get + - name: launch Test + continue-on-error: true + working-directory: ./client_flutter + run : | + flutter test + # Create key.properties file + - name: Create key.properties file + working-directory: ./client_flutter/android + run: | + touch key.properties + echo storePassword=${{secrets.FLUTTER_KEY_PASSWORD}} >> key.properties + echo keyPassword=${{secrets.FLUTTER_KEY_PASSWORD}} >> key.properties + echo keyAlias=${{secrets.FLUTTER_KEY_ALIAS}} >> key.properties + echo "${{secrets.FLUTTER_KEY_STORE}}" > upload-keystore.encoded + base64 -d -i upload-keystore.encoded > ~/upload-keystore.jks + echo storeFile=~/upload-keystore.jks >> key.properties + cat key.properties + ls -a + - name: build apk + working-directory: ./client_flutter + run : | + flutter build apk --no-tree-shake-icons + + - uses: actions/upload-artifact@v1 + with: + name: release-apk + path: client_flutter/build/app/outputs/flutter-apk/app-release.apk \ No newline at end of file diff --git a/app_flutter/.metadata b/app_flutter/.metadata deleted file mode 100644 index de745e4..0000000 --- a/app_flutter/.metadata +++ /dev/null @@ -1,45 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled. - -version: - revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - channel: stable - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: android - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: ios - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: linux - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: macos - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: web - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: windows - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/app_flutter/android/app/build.gradle b/app_flutter/android/app/build.gradle deleted file mode 100644 index a1178e7..0000000 --- a/app_flutter/android/app/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - namespace "com.example.app_flutter" - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - applicationId "kar_assistant.app_flutter" - minSdkVersion 28 - targetSdkVersion 30 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/app_flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app_flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 3d32c31..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-hdpi/round_launcher.png b/app_flutter/android/app/src/main/res/mipmap-hdpi/round_launcher.png deleted file mode 100644 index c9b3688..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-hdpi/round_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app_flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 999ab63..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-mdpi/round_launcher.png b/app_flutter/android/app/src/main/res/mipmap-mdpi/round_launcher.png deleted file mode 100644 index f7c06f6..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-mdpi/round_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 51c83e2..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xhdpi/round_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xhdpi/round_launcher.png deleted file mode 100644 index bf893cf..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xhdpi/round_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index fd2d258..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xxhdpi/round_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xxhdpi/round_launcher.png deleted file mode 100644 index 4600786..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xxhdpi/round_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 67e897c..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/round_launcher.png b/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/round_launcher.png deleted file mode 100644 index efb89b8..0000000 Binary files a/app_flutter/android/app/src/main/res/mipmap-xxxhdpi/round_launcher.png and /dev/null differ diff --git a/app_flutter/android/settings.gradle b/app_flutter/android/settings.gradle deleted file mode 100644 index 33f0745..0000000 --- a/app_flutter/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada4..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 7353c41..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 797d452..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index 6ed2d93..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cd7b00..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index fe73094..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index 321773c..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 797d452..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index 502f463..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index 0ec3034..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index 0ec3034..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index e9f5fea..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index 84ac32a..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 8953cba..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index 0467bf1..0000000 Binary files a/app_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/app_flutter/lib/assests/bottom_app_bar.dart b/app_flutter/lib/assests/bottom_app_bar.dart deleted file mode 100644 index f61a936..0000000 --- a/app_flutter/lib/assests/bottom_app_bar.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; - -class MyAppBarBottom extends StatelessWidget { - const MyAppBarBottom({ - this.shape, - }); - final NotchedShape? shape; - - @override - Widget build(BuildContext context) { - return Semantics( - container: true, - label: 'bottomBar', - child: BottomAppBar( - shape: shape, - child: IconTheme( - data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary), - child: Row( - children: [ - IconButton( - tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, - icon: const Icon(Icons.menu), - onPressed: () {}, - ), - const Spacer(), - IconButton( - tooltip: 'Demande favorite', - icon: const Icon(Icons.favorite), - onPressed: () {}, - ) - ], - ), - ), - ), - ); - } -} \ No newline at end of file diff --git a/app_flutter/lib/core/globals.dart b/app_flutter/lib/core/globals.dart deleted file mode 100644 index aa6e03a..0000000 --- a/app_flutter/lib/core/globals.dart +++ /dev/null @@ -1,3 +0,0 @@ -String? envBaseUrl; -String? envMode; -String? tokenApi; \ No newline at end of file diff --git a/app_flutter/lib/core/models/kara_response.dart b/app_flutter/lib/core/models/kara_response.dart deleted file mode 100644 index af7f3bc..0000000 --- a/app_flutter/lib/core/models/kara_response.dart +++ /dev/null @@ -1,32 +0,0 @@ - -import 'package:json_annotation/json_annotation.dart'; - -part 'kara_response.g.dart'; - -@JsonSerializable() -class KaraResponse { - - KaraResponse(); - - @JsonKey(name:"result") - late String result; - - @JsonKey(name:"lang") - late String language; - - @JsonKey(name:"skill") - late String skill; - - @JsonKey(name:"similarity") - late double similarity; - - @JsonKey(name:"bestPhrase") - late String bestPhrase; - - @JsonKey(name:"token") - late String? token; - - - factory KaraResponse.fromJson(Map json) => _$KaraResponseFromJson(json); - Map toJson() => _$KaraResponseToJson(this); -} \ No newline at end of file diff --git a/app_flutter/lib/core/repository/kara_repository.dart b/app_flutter/lib/core/repository/kara_repository.dart deleted file mode 100644 index a5026ee..0000000 --- a/app_flutter/lib/core/repository/kara_repository.dart +++ /dev/null @@ -1,4 +0,0 @@ - -abstract class KaraRepository { - Future heyKara(Map data ); -} \ No newline at end of file diff --git a/app_flutter/lib/core/widgets/animation_widget/ripple_animation.dart b/app_flutter/lib/core/widgets/animation_widget/ripple_animation.dart deleted file mode 100644 index 89d8151..0000000 --- a/app_flutter/lib/core/widgets/animation_widget/ripple_animation.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:flutter/material.dart'; -class RipplesAnimation extends StatefulWidget { - final double size; - final Color color; - final Widget child; - - - const RipplesAnimation({ - super.key, - this.size = 80.0, - this.color = Colors.red, - required this.child - }); - - @override - _RipplesAnimationState createState() => _RipplesAnimationState(); -} - -class _RipplesAnimationState extends State with TickerProviderStateMixin { - late AnimationController _controller; - @override - void initState() { - super.initState(); - _controller = AnimationController( - duration: const Duration(milliseconds: 2000), - vsync: this, - )..repeat(); - } - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - Widget _button() { - return Center( - child: ClipRRect( - borderRadius: BorderRadius.circular(widget.size), - child: DecoratedBox( - decoration: BoxDecoration( - gradient: RadialGradient( - colors: [ - widget.color, - ], - ), - ), - child: ScaleTransition( - scale: Tween(begin: 0.95, end: 1.0).animate( - CurvedAnimation( - parent: _controller, - curve: Curves.fastLinearToSlowEaseIn - ), - ), - child: widget.child - ), - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - return Center( - child: CustomPaint( - foregroundPainter: CirclePainter(), - child: SizedBox( - width: widget.size * 4.125, - height: widget.size * 4.125, - child: _button(), - ), - ), - ); - } -} - -class CirclePainter extends CustomPainter { - var wavePaint = Paint() - ..color = Colors.black - ..style = PaintingStyle.stroke - ..strokeWidth = 2.0 - ..isAntiAlias = true; - @override - void paint(Canvas canvas, Size size) { - double centerX = size.width / 2.0; - double centerY = size.height / 2.0; - canvas.drawCircle(Offset(centerX, centerY), 100.0, wavePaint); - } - @override - bool shouldRepaint(CirclePainter oldDelegate) { - return false; - } -} \ No newline at end of file diff --git a/app_flutter/lib/main.dart b/app_flutter/lib/main.dart deleted file mode 100644 index 0ff0cff..0000000 --- a/app_flutter/lib/main.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:kar_assistant/screens/home_page/view/home_page.dart'; -import 'package:kar_assistant/services/utils_controller.dart'; - -void main() { - UtilsController().initEnv(); - 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: 'kar_assistant', - 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 blue 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 HomePage(), - ); - } -} - -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: MainAxisAlignment.start, - 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. - ); - } -} diff --git a/app_flutter/lib/screens/home_page/controller/kara_controller.dart b/app_flutter/lib/screens/home_page/controller/kara_controller.dart deleted file mode 100644 index f78c817..0000000 --- a/app_flutter/lib/screens/home_page/controller/kara_controller.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:kar_assistant/core/models/kara_response.dart'; -import 'package:kar_assistant/core/repository/kara_repo.dart'; - -class KaraController{ - -final KaraRepo karaRepo = KaraRepo(); - KaraResponse? karaLastResponse; - Future askedKara(String text, ) async { - Map data = { - 'query': text, - 'token': karaLastResponse !=null ? karaLastResponse!.token ?? '' :'', - 'timeZone':'Europe/Paris' - }; - KaraResponse result; - result = await karaRepo.heyKara(data); - print(result.toJson()); - karaLastResponse=result; - return result; - } - - bool verifIsToken(){ - if(karaLastResponse!=null){ - if(karaLastResponse!.token != null){ - return true; - } - } - return false; - } - -} \ No newline at end of file diff --git a/app_flutter/lib/screens/home_page/view/home_page.dart b/app_flutter/lib/screens/home_page/view/home_page.dart deleted file mode 100644 index 5e762a5..0000000 --- a/app_flutter/lib/screens/home_page/view/home_page.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:kar_assistant/assests/bottom_app_bar.dart'; -import 'package:kar_assistant/screens/home_page/view/kara_talking.dart'; -import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; -import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; - -class HomePage extends StatefulWidget { - const HomePage({super.key}); - - final String title = " title"; - @override - State createState() => _HomePageState(); -} - -class _HomePageState extends State { - final KaraController karaController = KaraController(); - - @override - void initState() { - super.initState(); - } - - - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text("My name is Kara"), - backgroundColor: Theme.of(context).colorScheme.primary, - leading: const Icon(MdiIcons.home) ,), - body:Center( - child:KaraTalking(karaController) - ), - floatingActionButton: Semantics( - container: true, - child: FloatingActionButton( - onPressed: () {}, - tooltip: 'New', - child: const Icon(Icons.add), - ), - ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - bottomNavigationBar: const MyAppBarBottom( - shape: CircularNotchedRectangle(), - ), - ); - } -} \ No newline at end of file diff --git a/app_flutter/lib/screens/home_page/view/kara_talking.dart b/app_flutter/lib/screens/home_page/view/kara_talking.dart deleted file mode 100644 index 748a0e1..0000000 --- a/app_flutter/lib/screens/home_page/view/kara_talking.dart +++ /dev/null @@ -1,236 +0,0 @@ -import 'dart:async'; -import 'dart:io' show Platform; -import 'dart:math'; -import 'package:flutter/foundation.dart' show kIsWeb; - -import 'package:flutter/material.dart'; -import 'package:flutter_tts/flutter_tts.dart'; -import 'package:kar_assistant/core/models/kara_response.dart'; -import 'package:kar_assistant/core/widgets/animation_widget/ripple_animation.dart'; -import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; -import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; - -class KaraTalking extends StatefulWidget { - final KaraController karaController ; - const KaraTalking(this.karaController, {super.key}); - - @override - _KaraTalkingState createState() => _KaraTalkingState(); -} - -enum TtsState { playing, stopped } - -class _KaraTalkingState extends State { - - final SpeechToText _speechToText = SpeechToText(); - bool _speechEnabled = false; - String _lastWords = ''; - List listResponse = []; - - late FlutterTts flutterTts; - String? language; - String? engine; - double volume = 1.0; - double pitch = 1.0; - double rate = 0.6; - bool isCurrentLanguageInstalled = false; - - TtsState ttsState = TtsState.stopped; - - get isPlaying => ttsState == TtsState.playing; - // get isStopped => ttsState == TtsState.stopped; - // get isPaused => ttsState == TtsState.paused; - // get isContinued => ttsState == TtsState.continued; - - bool get isIOS => !kIsWeb && Platform.isIOS; - bool get isAndroid => !kIsWeb && Platform.isAndroid; - bool get isWindows => !kIsWeb && Platform.isWindows; - bool get isWeb => kIsWeb; - - @override - initState() { - super.initState(); - _initSpeech(); - initTts(); - } - - // ear Section - void _initSpeech() async { - _speechEnabled = await _speechToText.initialize(); - setState(() {}); - } - - void _startListening() async { - await _speechToText.listen( - onResult: _onSpeechResult, - localeId: 'FR', - listenMode: ListenMode.dictation, - ); - setState(() {}); - } - - void _stopListening() async { - await _speechToText.stop(); - } - - /// This is the callback that the SpeechToText plugin calls when - /// the platform returns recognized words. - void _onSpeechResult(SpeechRecognitionResult result) { - setState(() { - _lastWords = result.recognizedWords; - }); - if(result.finalResult==true){ - widget.karaController.askedKara(result.recognizedWords).then((KaraResponse response){ - setState(() { - _speak(response.result); - listResponse.add(response.result); - if(response.token!= null){ - - } - }); - }); - } - } - - //_____________________________________// - //talk Section - initTts() { - flutterTts = FlutterTts(); - - _setAwaitOptions(); - - if (isAndroid) { - _getDefaultEngine().then((defaultEngine) { - flutterTts.setEngine(defaultEngine); - },); - - _getDefaultVoice().then((defaultLanguage) { - flutterTts.setVoice(defaultLanguage); - },); - } - - flutterTts.setStartHandler(() { - setState(() { - print("Playing"); - ttsState = TtsState.playing; - }); - }); - - if (isAndroid) { - flutterTts.setInitHandler(() { - setState(() { - print("TTS Initialized"); - }); - }); - } - - flutterTts.setCompletionHandler(() { - setState(() { - print("Complete"); - ttsState = TtsState.stopped; - if(widget.karaController.verifIsToken()){ - _startListening(); - } - }); - }); - - flutterTts.setErrorHandler((msg) { - setState(() { - print("error: $msg"); - ttsState = TtsState.stopped; - }); - }); - } - - Future _getDefaultEngine() async { - var engine = await flutterTts.getDefaultEngine; - if (engine != null) { - return engine; - } - } - - Future _getDefaultVoice() async { - Map? voice = await flutterTts.getDefaultVoice; - if (voice != null){ - return voice; - } - } - - Future _speak(String? textToSpeak) async { - await flutterTts.setVolume(volume); - await flutterTts.setSpeechRate(rate); - await flutterTts.setPitch(pitch); - - if (textToSpeak != null) { - if (textToSpeak.isNotEmpty) { - await flutterTts.speak(textToSpeak); - } - } - } - - Future _setAwaitOptions() async { - await flutterTts.awaitSpeakCompletion(true); - } - - @override - void dispose() { - super.dispose(); - flutterTts.stop(); - } - - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - //RipplesAnimation - IconButton( - color: Colors.red, - icon: Icon( - _speechToText.isListening - ? MdiIcons.microphoneSettings - : MdiIcons.microphone, - size: 50, - ), - onPressed: () { - if(_speechToText.isListening){ - _stopListening(); - }else { - _startListening(); - } - setState(() { - }); - }, - ), - Container( - padding: const EdgeInsets.all(16), - child: Text( - _speechToText.isListening - ? _lastWords - : _speechEnabled - ? _lastWords.isEmpty - ? 'Tap the microphone to start listening...' - : _lastWords - : 'Speech not available', - ), - ), - ListView.builder( - reverse: true, - shrinkWrap: true, - itemCount: min(listResponse.length, 3), - itemBuilder: (context, index) { - if(listResponse.length >3){ - return Text(listResponse[listResponse.length-(3-index)]); - }else { - return Text(listResponse[index]); - } - }, - ), - ], - ); - } - -} \ No newline at end of file diff --git a/app_flutter/lib/services/http_repo.dart b/app_flutter/lib/services/http_repo.dart deleted file mode 100644 index d0c4046..0000000 --- a/app_flutter/lib/services/http_repo.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'package:kar_assistant/core/globals.dart' as globals; -import 'package:http/http.dart' as http; -import 'package:kar_assistant/services/http_repository.dart'; - -class HttpRepo implements HttpRepository { - int timeOutSeconds = 20; - String responseTimeOut = jsonEncode({'type': 'error', 'status': 408, 'message': 'Le serveur a mis trop de temps Ă  rĂ©pondre'}); - String responseOtherError = jsonEncode({'type': 'error', 'status': 404, 'message': 'Le serveur semble ne pas ĂȘtre accessible'}); - Map? header; - String baseUrl = globals.envBaseUrl!; - HttpRepo() { - if (globals.tokenApi != null) { - header = {'Content-Type': 'application/json; charset=UTF-8', 'Accept': 'application/json', 'Authorization': 'Bearer ${globals.tokenApi}'}; - } else { - header = { - 'Accept': 'application/json', - }; - } - } - - Uri getUri(String url, {Map? parameters}) { - String base = baseUrl.replaceAll("http://", ""); - base = base.replaceAll("https://", ""); - List listUrl = []; - listUrl = base.split("/"); - base = listUrl[0]; - listUrl.removeAt(0); - String chemin = ""; - if (listUrl.isEmpty) { - chemin = url; - } else { - chemin = "${listUrl.join("/")}/$url"; - } - if (baseUrl.contains("http://")) { - return Uri.http(base, chemin, parameters); - } else { - return Uri.https(base, chemin, parameters); - } - } - - @override - Future getRequest(String url) async { - http.Response response; - try { - response = await http - .get(getUri(url), headers: header) - .timeout( - Duration(seconds: timeOutSeconds), - onTimeout: () => http.Response(responseTimeOut, 408), - ) - .onError((error, stackTrace) => http.Response(responseOtherError, 503)); - - if (response.statusCode < 200 || response.statusCode > 299) { - final error = json.decode(response.body); - throw error['message']; - } - return response; - } catch (e) { - rethrow; - } - } - - @override - Future getRequestParams(String url, Map parameters) async { - http.Response response; - try { - print(parameters.toString()); - response = await http - .get(getUri(url, parameters:parameters), headers: header) - .timeout( - Duration(seconds: timeOutSeconds), - onTimeout: () => http.Response(responseTimeOut, 408), - ) - .onError((error, stackTrace) => http.Response(responseOtherError, 503)); - - if (response.statusCode < 200 || response.statusCode > 299) { - final error = json.decode(response.body); - throw error['message']; - } - return response; - } catch (e) { - rethrow; - } - } - - @override - Future postRequest(String url, Map data) async { - http.Response response; - - try { - print(Uri.encodeFull(jsonEncode(data))); - response = await http - .post(getUri(url), headers: header, body: Uri.encodeFull(jsonEncode(data))) - .timeout( - Duration(seconds: timeOutSeconds), - onTimeout: () => http.Response(responseTimeOut, 408), - ) - .onError((error, stackTrace) => http.Response(responseOtherError, 503)); - - if (response.statusCode < 200 || response.statusCode > 299) { - final error = json.decode(response.body); - throw error['message']; - } - return response; - } catch (e) { - rethrow; - } - } -} \ No newline at end of file diff --git a/app_flutter/lib/services/utils_controller.dart b/app_flutter/lib/services/utils_controller.dart deleted file mode 100644 index 8ec07b6..0000000 --- a/app_flutter/lib/services/utils_controller.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:kar_assistant/core/globals.dart' as globals; - -class UtilsController { - Future initEnv() async { - await dotenv.load(fileName: ".env"); - globals.envBaseUrl = dotenv.env['BASEURL'].toString(); - globals.envMode = dotenv.env['MODE'].toString(); - } -} \ No newline at end of file diff --git a/app_flutter/linux/.gitignore b/app_flutter/linux/.gitignore deleted file mode 100644 index c7ea17f..0000000 --- a/app_flutter/linux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -flutter/ephemeral diff --git a/app_flutter/linux/CMakeLists.txt b/app_flutter/linux/CMakeLists.txt deleted file mode 100644 index d705ccc..0000000 --- a/app_flutter/linux/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.10) -project(runner LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "app_flutter") -# The unique GTK application identifier for this application. See: -# https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.example.app_flutter") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(SET CMP0063 NEW) - -# Load bundled libraries from the lib/ directory relative to the binary. -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Root filesystem for cross-building. -if(FLUTTER_TARGET_PLATFORM_SYSROOT) - set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endif() - -# Define build configuration options. -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") -endif() - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_14) - target_compile_options(${TARGET} PRIVATE -Wall -Werror) - target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") - target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) - -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Define the application target. To change its name, change BINARY_NAME above, -# not the value here, or `flutter run` will no longer work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) - -# Only the install-generated bundle's copy of the executable will launch -# correctly, since the resources must in the right relative locations. To avoid -# people trying to run the unbundled copy, put it in a subdirectory instead of -# the default top-level location. -set_target_properties(${BINARY_NAME} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" -) - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# By default, "installing" just makes a relocatable bundle in the build -# directory. -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -# Start with a clean build bundle directory every time. -install(CODE " - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") - " COMPONENT Runtime) - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) - install(FILES "${bundled_library}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endforeach(bundled_library) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() diff --git a/app_flutter/linux/flutter/CMakeLists.txt b/app_flutter/linux/flutter/CMakeLists.txt deleted file mode 100644 index 27860e8..0000000 --- a/app_flutter/linux/flutter/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.10) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. - -# Serves the same purpose as list(TRANSFORM ... PREPEND ...), -# which isn't available in 3.10. -function(list_prepend LIST_NAME PREFIX) - set(NEW_LIST "") - foreach(element ${${LIST_NAME}}) - list(APPEND NEW_LIST "${PREFIX}${element}") - endforeach(element) - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) -endfunction() - -# === Flutter Library === -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) - -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "fl_basic_message_channel.h" - "fl_binary_codec.h" - "fl_binary_messenger.h" - "fl_dart_project.h" - "fl_engine.h" - "fl_json_message_codec.h" - "fl_json_method_codec.h" - "fl_message_codec.h" - "fl_method_call.h" - "fl_method_channel.h" - "fl_method_codec.h" - "fl_method_response.h" - "fl_plugin_registrar.h" - "fl_plugin_registry.h" - "fl_standard_message_codec.h" - "fl_standard_method_codec.h" - "fl_string_codec.h" - "fl_value.h" - "fl_view.h" - "flutter_linux.h" -) -list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") -target_link_libraries(flutter INTERFACE - PkgConfig::GTK - PkgConfig::GLIB - PkgConfig::GIO -) -add_dependencies(flutter flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CMAKE_CURRENT_BINARY_DIR}/_phony_ - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" - ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} -) diff --git a/app_flutter/linux/flutter/generated_plugin_registrant.cc b/app_flutter/linux/flutter/generated_plugin_registrant.cc deleted file mode 100644 index e71a16d..0000000 --- a/app_flutter/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,11 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - - -void fl_register_plugins(FlPluginRegistry* registry) { -} diff --git a/app_flutter/linux/flutter/generated_plugin_registrant.h b/app_flutter/linux/flutter/generated_plugin_registrant.h deleted file mode 100644 index e0f0a47..0000000 --- a/app_flutter/linux/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void fl_register_plugins(FlPluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/app_flutter/linux/flutter/generated_plugins.cmake b/app_flutter/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87..0000000 --- a/app_flutter/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/app_flutter/linux/main.cc b/app_flutter/linux/main.cc deleted file mode 100644 index 4340ffc..0000000 --- a/app_flutter/linux/main.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "my_application.h" - -int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); - return g_application_run(G_APPLICATION(app), argc, argv); -} diff --git a/app_flutter/linux/my_application.cc b/app_flutter/linux/my_application.cc deleted file mode 100644 index 4f06e34..0000000 --- a/app_flutter/linux/my_application.cc +++ /dev/null @@ -1,104 +0,0 @@ -#include "my_application.h" - -#include -#ifdef GDK_WINDOWING_X11 -#include -#endif - -#include "flutter/generated_plugin_registrant.h" - -struct _MyApplication { - GtkApplication parent_instance; - char** dart_entrypoint_arguments; -}; - -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) - -// Implements GApplication::activate. -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); - GtkWindow* window = - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - - // Use a header bar when running in GNOME as this is the common style used - // by applications and is the setup most users will be using (e.g. Ubuntu - // desktop). - // If running on X and not using GNOME then just use a traditional title bar - // in case the window manager does more exotic layout, e.g. tiling. - // If running on Wayland assume the header bar will work (may need changing - // if future cases occur). - gboolean use_header_bar = TRUE; -#ifdef GDK_WINDOWING_X11 - GdkScreen* screen = gtk_window_get_screen(window); - if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } - } -#endif - if (use_header_bar) { - GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "app_flutter"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } else { - gtk_window_set_title(window, "app_flutter"); - } - - gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); - - g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); - - FlView* view = fl_view_new(project); - gtk_widget_show(GTK_WIDGET(view)); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); - - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); - - gtk_widget_grab_focus(GTK_WIDGET(view)); -} - -// Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { - MyApplication* self = MY_APPLICATION(application); - // Strip out the first argument as it is the binary name. - self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); - - g_autoptr(GError) error = nullptr; - if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; - } - - g_application_activate(application); - *exit_status = 0; - - return TRUE; -} - -// Implements GObject::dispose. -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); - g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); -} - -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; -} - -static void my_application_init(MyApplication* self) {} - -MyApplication* my_application_new() { - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, - "flags", G_APPLICATION_NON_UNIQUE, - nullptr)); -} diff --git a/app_flutter/linux/my_application.h b/app_flutter/linux/my_application.h deleted file mode 100644 index 8f20fb5..0000000 --- a/app_flutter/linux/my_application.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/app_flutter/macos/.gitignore b/app_flutter/macos/.gitignore deleted file mode 100644 index d4e0569..0000000 --- a/app_flutter/macos/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Flutter-related -**/Flutter/ephemeral/ -**/Pods/ - -# Xcode-related -**/dgph -**/xcuserdata/ diff --git a/app_flutter/macos/Flutter/Flutter-Debug.xcconfig b/app_flutter/macos/Flutter/Flutter-Debug.xcconfig deleted file mode 100644 index f022c34..0000000 --- a/app_flutter/macos/Flutter/Flutter-Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/app_flutter/macos/Flutter/Flutter-Release.xcconfig b/app_flutter/macos/Flutter/Flutter-Release.xcconfig deleted file mode 100644 index f022c34..0000000 --- a/app_flutter/macos/Flutter/Flutter-Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/app_flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/app_flutter/macos/Flutter/GeneratedPluginRegistrant.swift deleted file mode 100644 index 294911a..0000000 --- a/app_flutter/macos/Flutter/GeneratedPluginRegistrant.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Generated file. Do not edit. -// - -import FlutterMacOS -import Foundation - -import flutter_tts -import path_provider_foundation -import speech_to_text_macos - -func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) - PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - SpeechToTextMacosPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextMacosPlugin")) -} diff --git a/app_flutter/macos/Runner.xcodeproj/project.pbxproj b/app_flutter/macos/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 140f684..0000000 --- a/app_flutter/macos/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,695 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXAggregateTarget section */ - 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; - buildPhases = ( - 33CC111E2044C6BF0003C045 /* ShellScript */, - ); - dependencies = ( - ); - name = "Flutter Assemble"; - productName = FLX; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC10EC2044A3C60003C045; - remoteInfo = Runner; - }; - 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 33CC10E52044A3C60003C045 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 33CC111A2044C6BA0003C045; - remoteInfo = FLX; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 33CC110E2044A8840003C045 /* Bundle Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Bundle Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* app_flutter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "app_flutter.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; - 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; - 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; - 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 331C80D2294CF70F00263BE5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EA2044A3C60003C045 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C80D6294CF71000263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C80D7294CF71000263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 33BA886A226E78AF003329D5 /* Configs */ = { - isa = PBXGroup; - children = ( - 33E5194F232828860026EE4D /* AppInfo.xcconfig */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, - ); - path = Configs; - sourceTree = ""; - }; - 33CC10E42044A3C60003C045 = { - isa = PBXGroup; - children = ( - 33FAB671232836740065AC1E /* Runner */, - 33CEB47122A05771004F2AC0 /* Flutter */, - 331C80D6294CF71000263BE5 /* RunnerTests */, - 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - ); - sourceTree = ""; - }; - 33CC10EE2044A3C60003C045 /* Products */ = { - isa = PBXGroup; - children = ( - 33CC10ED2044A3C60003C045 /* app_flutter.app */, - 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 33CC11242044D66E0003C045 /* Resources */ = { - isa = PBXGroup; - children = ( - 33CC10F22044A3C60003C045 /* Assets.xcassets */, - 33CC10F42044A3C60003C045 /* MainMenu.xib */, - 33CC10F72044A3C60003C045 /* Info.plist */, - ); - name = Resources; - path = ..; - sourceTree = ""; - }; - 33CEB47122A05771004F2AC0 /* Flutter */ = { - isa = PBXGroup; - children = ( - 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, - 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, - 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, - 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - ); - path = Flutter; - sourceTree = ""; - }; - 33FAB671232836740065AC1E /* Runner */ = { - isa = PBXGroup; - children = ( - 33CC10F02044A3C60003C045 /* AppDelegate.swift */, - 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, - 33E51913231747F40026EE4D /* DebugProfile.entitlements */, - 33E51914231749380026EE4D /* Release.entitlements */, - 33CC11242044D66E0003C045 /* Resources */, - 33BA886A226E78AF003329D5 /* Configs */, - ); - path = Runner; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 331C80D4294CF70F00263BE5 /* RunnerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; - buildPhases = ( - 331C80D1294CF70F00263BE5 /* Sources */, - 331C80D2294CF70F00263BE5 /* Frameworks */, - 331C80D3294CF70F00263BE5 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 331C80DA294CF71000263BE5 /* PBXTargetDependency */, - ); - name = RunnerTests; - productName = RunnerTests; - productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 33CC10EC2044A3C60003C045 /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 33CC10E92044A3C60003C045 /* Sources */, - 33CC10EA2044A3C60003C045 /* Frameworks */, - 33CC10EB2044A3C60003C045 /* Resources */, - 33CC110E2044A8840003C045 /* Bundle Framework */, - 3399D490228B24CF009A79C7 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 33CC11202044C79F0003C045 /* PBXTargetDependency */, - ); - name = Runner; - productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* app_flutter.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 33CC10E52044A3C60003C045 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 331C80D4294CF70F00263BE5 = { - CreatedOnToolsVersion = 14.0; - TestTargetID = 33CC10EC2044A3C60003C045; - }; - 33CC10EC2044A3C60003C045 = { - CreatedOnToolsVersion = 9.2; - LastSwiftMigration = 1100; - ProvisioningStyle = Automatic; - SystemCapabilities = { - com.apple.Sandbox = { - enabled = 1; - }; - }; - }; - 33CC111A2044C6BA0003C045 = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 33CC10E42044A3C60003C045; - productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 33CC10EC2044A3C60003C045 /* Runner */, - 331C80D4294CF70F00263BE5 /* RunnerTests */, - 33CC111A2044C6BA0003C045 /* Flutter Assemble */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 331C80D3294CF70F00263BE5 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10EB2044A3C60003C045 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, - 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3399D490228B24CF009A79C7 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; - }; - 33CC111E2044C6BF0003C045 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - Flutter/ephemeral/FlutterInputs.xcfilelist, - ); - inputPaths = ( - Flutter/ephemeral/tripwire, - ); - outputFileListPaths = ( - Flutter/ephemeral/FlutterOutputs.xcfilelist, - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 331C80D1294CF70F00263BE5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 33CC10E92044A3C60003C045 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, - 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, - 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC10EC2044A3C60003C045 /* Runner */; - targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; - }; - 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; - targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 33CC10F52044A3C60003C045 /* Base */, - ); - name = MainMenu.xib; - path = Runner; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 331C80DB294CF71000263BE5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.appFlutter.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/app_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/app_flutter"; - }; - name = Debug; - }; - 331C80DC294CF71000263BE5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.appFlutter.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/app_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/app_flutter"; - }; - name = Release; - }; - 331C80DD294CF71000263BE5 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.appFlutter.RunnerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/app_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/app_flutter"; - }; - name = Profile; - }; - 338D0CE9231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Profile; - }; - 338D0CEA231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Profile; - }; - 338D0CEB231458BD00FA5F75 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Profile; - }; - 33CC10F92044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 33CC10FA2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - 33CC10FC2044A3C60003C045 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 33CC10FD2044A3C60003C045 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 33CC111C2044C6BA0003C045 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Manual; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 33CC111D2044C6BA0003C045 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 331C80DB294CF71000263BE5 /* Debug */, - 331C80DC294CF71000263BE5 /* Release */, - 331C80DD294CF71000263BE5 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10F92044A3C60003C045 /* Debug */, - 33CC10FA2044A3C60003C045 /* Release */, - 338D0CE9231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC10FC2044A3C60003C045 /* Debug */, - 33CC10FD2044A3C60003C045 /* Release */, - 338D0CEA231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 33CC111C2044C6BA0003C045 /* Debug */, - 33CC111D2044C6BA0003C045 /* Release */, - 338D0CEB231458BD00FA5F75 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 33CC10E52044A3C60003C045 /* Project object */; -} diff --git a/app_flutter/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app_flutter/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index fc6bf80..0000000 --- a/app_flutter/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/app_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/app_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 039373a..0000000 --- a/app_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app_flutter/macos/Runner.xcworkspace/contents.xcworkspacedata b/app_flutter/macos/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 59c6d39..0000000 --- a/app_flutter/macos/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/app_flutter/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app_flutter/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index fc6bf80..0000000 --- a/app_flutter/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/app_flutter/macos/Runner/AppDelegate.swift b/app_flutter/macos/Runner/AppDelegate.swift deleted file mode 100644 index 553a135..0000000 --- a/app_flutter/macos/Runner/AppDelegate.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Cocoa -import FlutterMacOS - -@NSApplicationMain -class AppDelegate: FlutterAppDelegate { - override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true - } -} diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 8d4e7cb..0000000 --- a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png deleted file mode 100644 index 82b6f9d..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png deleted file mode 100644 index 13b35eb..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png deleted file mode 100644 index 0a3f5fa..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png deleted file mode 100644 index bdb5722..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png deleted file mode 100644 index f083318..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png deleted file mode 100644 index 326c0e7..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png deleted file mode 100644 index 2f1632c..0000000 Binary files a/app_flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and /dev/null differ diff --git a/app_flutter/macos/Runner/Base.lproj/MainMenu.xib b/app_flutter/macos/Runner/Base.lproj/MainMenu.xib deleted file mode 100644 index 4632c69..0000000 --- a/app_flutter/macos/Runner/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app_flutter/macos/Runner/Configs/AppInfo.xcconfig b/app_flutter/macos/Runner/Configs/AppInfo.xcconfig deleted file mode 100644 index 7a13a46..0000000 --- a/app_flutter/macos/Runner/Configs/AppInfo.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -// Application-level settings for the Runner target. -// -// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the -// future. If not, the values below would default to using the project name when this becomes a -// 'flutter create' template. - -// The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = app_flutter - -// The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.appFlutter - -// The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. diff --git a/app_flutter/macos/Runner/Configs/Debug.xcconfig b/app_flutter/macos/Runner/Configs/Debug.xcconfig deleted file mode 100644 index b398823..0000000 --- a/app_flutter/macos/Runner/Configs/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Debug.xcconfig" -#include "Warnings.xcconfig" diff --git a/app_flutter/macos/Runner/Configs/Release.xcconfig b/app_flutter/macos/Runner/Configs/Release.xcconfig deleted file mode 100644 index d93e5dc..0000000 --- a/app_flutter/macos/Runner/Configs/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../Flutter/Flutter-Release.xcconfig" -#include "Warnings.xcconfig" diff --git a/app_flutter/macos/Runner/Configs/Warnings.xcconfig b/app_flutter/macos/Runner/Configs/Warnings.xcconfig deleted file mode 100644 index fb4d7d3..0000000 --- a/app_flutter/macos/Runner/Configs/Warnings.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES -CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_PRAGMA_PACK = YES -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_COMMA = YES -GCC_WARN_STRICT_SELECTOR_MATCH = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -GCC_WARN_SHADOW = YES -CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/app_flutter/macos/Runner/DebugProfile.entitlements b/app_flutter/macos/Runner/DebugProfile.entitlements deleted file mode 100644 index 51d0967..0000000 --- a/app_flutter/macos/Runner/DebugProfile.entitlements +++ /dev/null @@ -1,12 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.cs.allow-jit - - com.apple.security.network.server - - - diff --git a/app_flutter/macos/Runner/Info.plist b/app_flutter/macos/Runner/Info.plist deleted file mode 100644 index 3733c1a..0000000 --- a/app_flutter/macos/Runner/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - $(PRODUCT_COPYRIGHT) - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/app_flutter/macos/Runner/MainFlutterWindow.swift b/app_flutter/macos/Runner/MainFlutterWindow.swift deleted file mode 100644 index ab30cba..0000000 --- a/app_flutter/macos/Runner/MainFlutterWindow.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Cocoa -import FlutterMacOS - -class MainFlutterWindow: NSWindow { - override func awakeFromNib() { - let flutterViewController = FlutterViewController() - let windowFrame = self.frame - self.contentViewController = flutterViewController - self.setFrame(windowFrame, display: true) - - RegisterGeneratedPlugins(registry: flutterViewController) - - super.awakeFromNib() - } -} diff --git a/app_flutter/macos/Runner/Release.entitlements b/app_flutter/macos/Runner/Release.entitlements deleted file mode 100644 index 04336df..0000000 --- a/app_flutter/macos/Runner/Release.entitlements +++ /dev/null @@ -1,8 +0,0 @@ - - - - - com.apple.security.app-sandbox - - - diff --git a/app_flutter/macos/RunnerTests/RunnerTests.swift b/app_flutter/macos/RunnerTests/RunnerTests.swift deleted file mode 100644 index ba12981..0000000 --- a/app_flutter/macos/RunnerTests/RunnerTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import FlutterMacOS -import Cocoa -import XCTest - -class RunnerTests: XCTestCase { - - func testExample() { - // If you add code to the Runner application, consider adding tests here. - // See https://developer.apple.com/documentation/xctest for more information about using XCTest. - } - -} diff --git a/app_flutter/test/widget_test.dart b/app_flutter/test/widget_test.dart deleted file mode 100644 index 0bc9e4a..0000000 --- a/app_flutter/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:kar_assistant/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/app_flutter/web/favicon.png b/app_flutter/web/favicon.png deleted file mode 100644 index 8aaa46a..0000000 Binary files a/app_flutter/web/favicon.png and /dev/null differ diff --git a/app_flutter/web/icons/Icon-192.png b/app_flutter/web/icons/Icon-192.png deleted file mode 100644 index b749bfe..0000000 Binary files a/app_flutter/web/icons/Icon-192.png and /dev/null differ diff --git a/app_flutter/web/icons/Icon-512.png b/app_flutter/web/icons/Icon-512.png deleted file mode 100644 index 88cfd48..0000000 Binary files a/app_flutter/web/icons/Icon-512.png and /dev/null differ diff --git a/app_flutter/web/icons/Icon-maskable-192.png b/app_flutter/web/icons/Icon-maskable-192.png deleted file mode 100644 index eb9b4d7..0000000 Binary files a/app_flutter/web/icons/Icon-maskable-192.png and /dev/null differ diff --git a/app_flutter/web/icons/Icon-maskable-512.png b/app_flutter/web/icons/Icon-maskable-512.png deleted file mode 100644 index d69c566..0000000 Binary files a/app_flutter/web/icons/Icon-maskable-512.png and /dev/null differ diff --git a/app_flutter/web/index.html b/app_flutter/web/index.html deleted file mode 100644 index 087ac75..0000000 --- a/app_flutter/web/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - app_flutter - - - - - - - - - - diff --git a/app_flutter/web/manifest.json b/app_flutter/web/manifest.json deleted file mode 100644 index 903a110..0000000 --- a/app_flutter/web/manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "app_flutter", - "short_name": "app_flutter", - "start_url": ".", - "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", - "description": "A new Flutter project.", - "orientation": "portrait-primary", - "prefer_related_applications": false, - "icons": [ - { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "icons/Icon-maskable-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "icons/Icon-maskable-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ] -} diff --git a/app_flutter/windows/.gitignore b/app_flutter/windows/.gitignore deleted file mode 100644 index ec4098a..0000000 --- a/app_flutter/windows/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -flutter/ephemeral/ - -# Visual Studio user-specific files. -*.suo -*.user -*.userosscache -*.sln.docstates - -# Visual Studio build-related files. -x64/ -x86/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ diff --git a/app_flutter/windows/CMakeLists.txt b/app_flutter/windows/CMakeLists.txt deleted file mode 100644 index fd7900f..0000000 --- a/app_flutter/windows/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.14) -project(app_flutter LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "app_flutter") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(SET CMP0063 NEW) - -# Define build configuration option. -get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(IS_MULTICONFIG) - set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" - CACHE STRING "" FORCE) -else() - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") - endif() -endif() -# Define settings for the Profile build mode. -set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") -set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") -set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") -set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") - -# Use Unicode for all projects. -add_definitions(-DUNICODE -D_UNICODE) - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") - target_compile_options(${TARGET} PRIVATE /EHsc) - target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") - target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# Application build; see runner/CMakeLists.txt. -add_subdirectory("runner") - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# Support files are copied into place next to the executable, so that it can -# run in place. This is done instead of making a separate bundle (as on Linux) -# so that building and running from within Visual Studio will work. -set(BUILD_BUNDLE_DIR "$") -# Make the "install" step default, as it's required to run. -set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - CONFIGURATIONS Profile;Release - COMPONENT Runtime) diff --git a/app_flutter/windows/flutter/CMakeLists.txt b/app_flutter/windows/flutter/CMakeLists.txt deleted file mode 100644 index 3f71e17..0000000 --- a/app_flutter/windows/flutter/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.14) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. -set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") - -# === Flutter Library === -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "flutter_export.h" - "flutter_windows.h" - "flutter_messenger.h" - "flutter_plugin_registrar.h" - "flutter_texture_registrar.h" -) -list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") -add_dependencies(flutter flutter_assemble) - -# === Wrapper === -list(APPEND CPP_WRAPPER_SOURCES_CORE - "core_implementations.cc" - "standard_codec.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_PLUGIN - "plugin_registrar.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_APP - "flutter_engine.cc" - "flutter_view_controller.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") - -# Wrapper sources needed for a plugin. -add_library(flutter_wrapper_plugin STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} -) -apply_standard_settings(flutter_wrapper_plugin) -set_target_properties(flutter_wrapper_plugin PROPERTIES - POSITION_INDEPENDENT_CODE ON) -set_target_properties(flutter_wrapper_plugin PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) -target_include_directories(flutter_wrapper_plugin PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_plugin flutter_assemble) - -# Wrapper sources needed for the runner. -add_library(flutter_wrapper_app STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_APP} -) -apply_standard_settings(flutter_wrapper_app) -target_link_libraries(flutter_wrapper_app PUBLIC flutter) -target_include_directories(flutter_wrapper_app PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_app flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") -set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} - ${PHONY_OUTPUT} - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} -) diff --git a/app_flutter/windows/flutter/generated_plugin_registrant.cc b/app_flutter/windows/flutter/generated_plugin_registrant.cc deleted file mode 100644 index bf3b1fe..0000000 --- a/app_flutter/windows/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,17 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include - -void RegisterPlugins(flutter::PluginRegistry* registry) { - FlutterTtsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterTtsPlugin")); - PermissionHandlerWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); -} diff --git a/app_flutter/windows/flutter/generated_plugin_registrant.h b/app_flutter/windows/flutter/generated_plugin_registrant.h deleted file mode 100644 index dc139d8..0000000 --- a/app_flutter/windows/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void RegisterPlugins(flutter::PluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/app_flutter/windows/flutter/generated_plugins.cmake b/app_flutter/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 004bc8c..0000000 --- a/app_flutter/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - flutter_tts - permission_handler_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/app_flutter/windows/runner/CMakeLists.txt b/app_flutter/windows/runner/CMakeLists.txt deleted file mode 100644 index 2041a04..0000000 --- a/app_flutter/windows/runner/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(runner LANGUAGES CXX) - -# Define the application target. To change its name, change BINARY_NAME in the -# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer -# work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} WIN32 - "flutter_window.cpp" - "main.cpp" - "utils.cpp" - "win32_window.cpp" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" - "Runner.rc" - "runner.exe.manifest" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add preprocessor definitions for the build version. -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") -target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") - -# Disable Windows macros that collide with C++ standard library functions. -target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") - -# Add dependency libraries and include directories. Add any application-specific -# dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) -target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") -target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/app_flutter/windows/runner/Runner.rc b/app_flutter/windows/runner/Runner.rc deleted file mode 100644 index 81e8ae5..0000000 --- a/app_flutter/windows/runner/Runner.rc +++ /dev/null @@ -1,121 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#pragma code_page(65001) -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_APP_ICON ICON "resources\\app_icon.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) -#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD -#else -#define VERSION_AS_NUMBER 1,0,0,0 -#endif - -#if defined(FLUTTER_VERSION) -#define VERSION_AS_STRING FLUTTER_VERSION -#else -#define VERSION_AS_STRING "1.0.0" -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_AS_NUMBER - PRODUCTVERSION VERSION_AS_NUMBER - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "app_flutter" "\0" - VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "app_flutter" "\0" - VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "app_flutter.exe" "\0" - VALUE "ProductName", "app_flutter" "\0" - VALUE "ProductVersion", VERSION_AS_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/app_flutter/windows/runner/flutter_window.cpp b/app_flutter/windows/runner/flutter_window.cpp deleted file mode 100644 index 490813d..0000000 --- a/app_flutter/windows/runner/flutter_window.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "flutter_window.h" - -#include - -#include "flutter/generated_plugin_registrant.h" - -FlutterWindow::FlutterWindow(const flutter::DartProject& project) - : project_(project) {} - -FlutterWindow::~FlutterWindow() {} - -bool FlutterWindow::OnCreate() { - if (!Win32Window::OnCreate()) { - return false; - } - - RECT frame = GetClientArea(); - - // The size here must match the window dimensions to avoid unnecessary surface - // creation / destruction in the startup path. - flutter_controller_ = std::make_unique( - frame.right - frame.left, frame.bottom - frame.top, project_); - // Ensure that basic setup of the controller was successful. - if (!flutter_controller_->engine() || !flutter_controller_->view()) { - return false; - } - RegisterPlugins(flutter_controller_->engine()); - SetChildContent(flutter_controller_->view()->GetNativeWindow()); - - flutter_controller_->engine()->SetNextFrameCallback([&]() { - this->Show(); - }); - - return true; -} - -void FlutterWindow::OnDestroy() { - if (flutter_controller_) { - flutter_controller_ = nullptr; - } - - Win32Window::OnDestroy(); -} - -LRESULT -FlutterWindow::MessageHandler(HWND hwnd, UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opportunity to handle window messages. - if (flutter_controller_) { - std::optional result = - flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, - lparam); - if (result) { - return *result; - } - } - - switch (message) { - case WM_FONTCHANGE: - flutter_controller_->engine()->ReloadSystemFonts(); - break; - } - - return Win32Window::MessageHandler(hwnd, message, wparam, lparam); -} diff --git a/app_flutter/windows/runner/flutter_window.h b/app_flutter/windows/runner/flutter_window.h deleted file mode 100644 index 28c2383..0000000 --- a/app_flutter/windows/runner/flutter_window.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RUNNER_FLUTTER_WINDOW_H_ -#define RUNNER_FLUTTER_WINDOW_H_ - -#include -#include - -#include - -#include "win32_window.h" - -// A window that does nothing but host a Flutter view. -class FlutterWindow : public Win32Window { - public: - // Creates a new FlutterWindow hosting a Flutter view running |project|. - explicit FlutterWindow(const flutter::DartProject& project); - virtual ~FlutterWindow(); - - protected: - // Win32Window: - bool OnCreate() override; - void OnDestroy() override; - LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, - LPARAM const lparam) noexcept override; - - private: - // The project to run. - flutter::DartProject project_; - - // The Flutter instance hosted by this window. - std::unique_ptr flutter_controller_; -}; - -#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/app_flutter/windows/runner/main.cpp b/app_flutter/windows/runner/main.cpp deleted file mode 100644 index dbf783b..0000000 --- a/app_flutter/windows/runner/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#include "flutter_window.h" -#include "utils.h" - -int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, - _In_ wchar_t *command_line, _In_ int show_command) { - // Attach to console when present (e.g., 'flutter run') or create a - // new console when running with a debugger. - if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { - CreateAndAttachConsole(); - } - - // Initialize COM, so that it is available for use in the library and/or - // plugins. - ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); - - flutter::DartProject project(L"data"); - - std::vector command_line_arguments = - GetCommandLineArguments(); - - project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); - - FlutterWindow window(project); - Win32Window::Point origin(10, 10); - Win32Window::Size size(1280, 720); - if (!window.Create(L"app_flutter", origin, size)) { - return EXIT_FAILURE; - } - window.SetQuitOnClose(true); - - ::MSG msg; - while (::GetMessage(&msg, nullptr, 0, 0)) { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - ::CoUninitialize(); - return EXIT_SUCCESS; -} diff --git a/app_flutter/windows/runner/resource.h b/app_flutter/windows/runner/resource.h deleted file mode 100644 index ddc7f3e..0000000 --- a/app_flutter/windows/runner/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Runner.rc -// -#define IDI_APP_ICON 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/app_flutter/windows/runner/resources/app_icon.ico b/app_flutter/windows/runner/resources/app_icon.ico deleted file mode 100644 index c04e20c..0000000 Binary files a/app_flutter/windows/runner/resources/app_icon.ico and /dev/null differ diff --git a/app_flutter/windows/runner/runner.exe.manifest b/app_flutter/windows/runner/runner.exe.manifest deleted file mode 100644 index 157e871..0000000 --- a/app_flutter/windows/runner/runner.exe.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - PerMonitorV2 - - - - - - - - - - - - - - - diff --git a/app_flutter/windows/runner/utils.cpp b/app_flutter/windows/runner/utils.cpp deleted file mode 100644 index fc55c57..0000000 --- a/app_flutter/windows/runner/utils.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "utils.h" - -#include -#include -#include -#include - -#include - -void CreateAndAttachConsole() { - if (::AllocConsole()) { - FILE *unused; - if (freopen_s(&unused, "CONOUT$", "w", stdout)) { - _dup2(_fileno(stdout), 1); - } - if (freopen_s(&unused, "CONOUT$", "w", stderr)) { - _dup2(_fileno(stdout), 2); - } - std::ios::sync_with_stdio(); - FlutterDesktopResyncOutputStreams(); - } -} - -std::vector GetCommandLineArguments() { - // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. - int argc; - wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); - if (argv == nullptr) { - return std::vector(); - } - - std::vector command_line_arguments; - - // Skip the first argument as it's the binary name. - for (int i = 1; i < argc; i++) { - command_line_arguments.push_back(Utf8FromUtf16(argv[i])); - } - - ::LocalFree(argv); - - return command_line_arguments; -} - -std::string Utf8FromUtf16(const wchar_t* utf16_string) { - if (utf16_string == nullptr) { - return std::string(); - } - int target_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr) - -1; // remove the trailing null character - int input_length = (int)wcslen(utf16_string); - std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { - return utf8_string; - } - utf8_string.resize(target_length); - int converted_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - input_length, utf8_string.data(), target_length, nullptr, nullptr); - if (converted_length == 0) { - return std::string(); - } - return utf8_string; -} diff --git a/app_flutter/windows/runner/utils.h b/app_flutter/windows/runner/utils.h deleted file mode 100644 index 3f0e05c..0000000 --- a/app_flutter/windows/runner/utils.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RUNNER_UTILS_H_ -#define RUNNER_UTILS_H_ - -#include -#include - -// Creates a console for the process, and redirects stdout and stderr to -// it for both the runner and the Flutter library. -void CreateAndAttachConsole(); - -// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string -// encoded in UTF-8. Returns an empty std::string on failure. -std::string Utf8FromUtf16(const wchar_t* utf16_string); - -// Gets the command line arguments passed in as a std::vector, -// encoded in UTF-8. Returns an empty std::vector on failure. -std::vector GetCommandLineArguments(); - -#endif // RUNNER_UTILS_H_ diff --git a/app_flutter/windows/runner/win32_window.cpp b/app_flutter/windows/runner/win32_window.cpp deleted file mode 100644 index b5ba2a0..0000000 --- a/app_flutter/windows/runner/win32_window.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include "win32_window.h" - -#include -#include - -#include "resource.h" - -namespace { - -/// Window attribute that enables dark mode window decorations. -/// -/// Redefined in case the developer's machine has a Windows SDK older than -/// version 10.0.22000.0. -/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute -#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE -#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 -#endif - -constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; - -/// Registry key for app theme preference. -/// -/// A value of 0 indicates apps should use dark mode. A non-zero or missing -/// value indicates apps should use light mode. -constexpr const wchar_t kGetPreferredBrightnessRegKey[] = - L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; -constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; - -// The number of Win32Window objects that currently exist. -static int g_active_window_count = 0; - -using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); - -// Scale helper to convert logical scaler values to physical using passed in -// scale factor -int Scale(int source, double scale_factor) { - return static_cast(source * scale_factor); -} - -// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. -// This API is only needed for PerMonitor V1 awareness mode. -void EnableFullDpiSupportIfAvailable(HWND hwnd) { - HMODULE user32_module = LoadLibraryA("User32.dll"); - if (!user32_module) { - return; - } - auto enable_non_client_dpi_scaling = - reinterpret_cast( - GetProcAddress(user32_module, "EnableNonClientDpiScaling")); - if (enable_non_client_dpi_scaling != nullptr) { - enable_non_client_dpi_scaling(hwnd); - } - FreeLibrary(user32_module); -} - -} // namespace - -// Manages the Win32Window's window class registration. -class WindowClassRegistrar { - public: - ~WindowClassRegistrar() = default; - - // Returns the singleton registrar instance. - static WindowClassRegistrar* GetInstance() { - if (!instance_) { - instance_ = new WindowClassRegistrar(); - } - return instance_; - } - - // Returns the name of the window class, registering the class if it hasn't - // previously been registered. - const wchar_t* GetWindowClass(); - - // Unregisters the window class. Should only be called if there are no - // instances of the window. - void UnregisterWindowClass(); - - private: - WindowClassRegistrar() = default; - - static WindowClassRegistrar* instance_; - - bool class_registered_ = false; -}; - -WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; - -const wchar_t* WindowClassRegistrar::GetWindowClass() { - if (!class_registered_) { - WNDCLASS window_class{}; - window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); - window_class.lpszClassName = kWindowClassName; - window_class.style = CS_HREDRAW | CS_VREDRAW; - window_class.cbClsExtra = 0; - window_class.cbWndExtra = 0; - window_class.hInstance = GetModuleHandle(nullptr); - window_class.hIcon = - LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); - window_class.hbrBackground = 0; - window_class.lpszMenuName = nullptr; - window_class.lpfnWndProc = Win32Window::WndProc; - RegisterClass(&window_class); - class_registered_ = true; - } - return kWindowClassName; -} - -void WindowClassRegistrar::UnregisterWindowClass() { - UnregisterClass(kWindowClassName, nullptr); - class_registered_ = false; -} - -Win32Window::Win32Window() { - ++g_active_window_count; -} - -Win32Window::~Win32Window() { - --g_active_window_count; - Destroy(); -} - -bool Win32Window::Create(const std::wstring& title, - const Point& origin, - const Size& size) { - Destroy(); - - const wchar_t* window_class = - WindowClassRegistrar::GetInstance()->GetWindowClass(); - - const POINT target_point = {static_cast(origin.x), - static_cast(origin.y)}; - HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); - UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); - double scale_factor = dpi / 96.0; - - HWND window = CreateWindow( - window_class, title.c_str(), WS_OVERLAPPEDWINDOW, - Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), - Scale(size.width, scale_factor), Scale(size.height, scale_factor), - nullptr, nullptr, GetModuleHandle(nullptr), this); - - if (!window) { - return false; - } - - UpdateTheme(window); - - return OnCreate(); -} - -bool Win32Window::Show() { - return ShowWindow(window_handle_, SW_SHOWNORMAL); -} - -// static -LRESULT CALLBACK Win32Window::WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - if (message == WM_NCCREATE) { - auto window_struct = reinterpret_cast(lparam); - SetWindowLongPtr(window, GWLP_USERDATA, - reinterpret_cast(window_struct->lpCreateParams)); - - auto that = static_cast(window_struct->lpCreateParams); - EnableFullDpiSupportIfAvailable(window); - that->window_handle_ = window; - } else if (Win32Window* that = GetThisFromHandle(window)) { - return that->MessageHandler(window, message, wparam, lparam); - } - - return DefWindowProc(window, message, wparam, lparam); -} - -LRESULT -Win32Window::MessageHandler(HWND hwnd, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - switch (message) { - case WM_DESTROY: - window_handle_ = nullptr; - Destroy(); - if (quit_on_close_) { - PostQuitMessage(0); - } - return 0; - - case WM_DPICHANGED: { - auto newRectSize = reinterpret_cast(lparam); - LONG newWidth = newRectSize->right - newRectSize->left; - LONG newHeight = newRectSize->bottom - newRectSize->top; - - SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, - newHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - return 0; - } - case WM_SIZE: { - RECT rect = GetClientArea(); - if (child_content_ != nullptr) { - // Size and position the child window. - MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE); - } - return 0; - } - - case WM_ACTIVATE: - if (child_content_ != nullptr) { - SetFocus(child_content_); - } - return 0; - - case WM_DWMCOLORIZATIONCOLORCHANGED: - UpdateTheme(hwnd); - return 0; - } - - return DefWindowProc(window_handle_, message, wparam, lparam); -} - -void Win32Window::Destroy() { - OnDestroy(); - - if (window_handle_) { - DestroyWindow(window_handle_); - window_handle_ = nullptr; - } - if (g_active_window_count == 0) { - WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); - } -} - -Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast( - GetWindowLongPtr(window, GWLP_USERDATA)); -} - -void Win32Window::SetChildContent(HWND content) { - child_content_ = content; - SetParent(content, window_handle_); - RECT frame = GetClientArea(); - - MoveWindow(content, frame.left, frame.top, frame.right - frame.left, - frame.bottom - frame.top, true); - - SetFocus(child_content_); -} - -RECT Win32Window::GetClientArea() { - RECT frame; - GetClientRect(window_handle_, &frame); - return frame; -} - -HWND Win32Window::GetHandle() { - return window_handle_; -} - -void Win32Window::SetQuitOnClose(bool quit_on_close) { - quit_on_close_ = quit_on_close; -} - -bool Win32Window::OnCreate() { - // No-op; provided for subclasses. - return true; -} - -void Win32Window::OnDestroy() { - // No-op; provided for subclasses. -} - -void Win32Window::UpdateTheme(HWND const window) { - DWORD light_mode; - DWORD light_mode_size = sizeof(light_mode); - LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, - kGetPreferredBrightnessRegValue, - RRF_RT_REG_DWORD, nullptr, &light_mode, - &light_mode_size); - - if (result == ERROR_SUCCESS) { - BOOL enable_dark_mode = light_mode == 0; - DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, - &enable_dark_mode, sizeof(enable_dark_mode)); - } -} diff --git a/app_flutter/windows/runner/win32_window.h b/app_flutter/windows/runner/win32_window.h deleted file mode 100644 index 49b847f..0000000 --- a/app_flutter/windows/runner/win32_window.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef RUNNER_WIN32_WINDOW_H_ -#define RUNNER_WIN32_WINDOW_H_ - -#include - -#include -#include -#include - -// A class abstraction for a high DPI-aware Win32 Window. Intended to be -// inherited from by classes that wish to specialize with custom -// rendering and input handling -class Win32Window { - public: - struct Point { - unsigned int x; - unsigned int y; - Point(unsigned int x, unsigned int y) : x(x), y(y) {} - }; - - struct Size { - unsigned int width; - unsigned int height; - Size(unsigned int width, unsigned int height) - : width(width), height(height) {} - }; - - Win32Window(); - virtual ~Win32Window(); - - // Creates a win32 window with |title| that is positioned and sized using - // |origin| and |size|. New windows are created on the default monitor. Window - // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size this function will scale the inputted width and height as - // as appropriate for the default monitor. The window is invisible until - // |Show| is called. Returns true if the window was created successfully. - bool Create(const std::wstring& title, const Point& origin, const Size& size); - - // Show the current window. Returns true if the window was successfully shown. - bool Show(); - - // Release OS resources associated with window. - void Destroy(); - - // Inserts |content| into the window tree. - void SetChildContent(HWND content); - - // Returns the backing Window handle to enable clients to set icon and other - // window properties. Returns nullptr if the window has been destroyed. - HWND GetHandle(); - - // If true, closing this window will quit the application. - void SetQuitOnClose(bool quit_on_close); - - // Return a RECT representing the bounds of the current client area. - RECT GetClientArea(); - - protected: - // Processes and route salient window messages for mouse handling, - // size change and DPI. Delegates handling of these to member overloads that - // inheriting classes can handle. - virtual LRESULT MessageHandler(HWND window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Called when CreateAndShow is called, allowing subclass window-related - // setup. Subclasses should return false if setup fails. - virtual bool OnCreate(); - - // Called when Destroy is called. - virtual void OnDestroy(); - - private: - friend class WindowClassRegistrar; - - // OS callback called by message pump. Handles the WM_NCCREATE message which - // is passed when the non-client area is being created and enables automatic - // non-client DPI scaling so that the non-client area automatically - // responds to changes in DPI. All other messages are handled by - // MessageHandler. - static LRESULT CALLBACK WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Retrieves a class instance pointer for |window| - static Win32Window* GetThisFromHandle(HWND const window) noexcept; - - // Update the window frame's theme to match the system theme. - static void UpdateTheme(HWND const window); - - bool quit_on_close_ = false; - - // window handle for top level window. - HWND window_handle_ = nullptr; - - // window handle for hosted content. - HWND child_content_ = nullptr; -}; - -#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/app_flutter/.gitignore b/client_flutter/.gitignore similarity index 94% rename from app_flutter/.gitignore rename to client_flutter/.gitignore index 60a4414..d70f782 100644 --- a/app_flutter/.gitignore +++ b/client_flutter/.gitignore @@ -9,6 +9,7 @@ .history .svn/ migrate_working_dir/ +.env # IntelliJ related *.iml @@ -31,7 +32,6 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ -.env # Symbolication related app.*.symbols diff --git a/client_flutter/.metadata b/client_flutter/.metadata new file mode 100644 index 0000000..620e877 --- /dev/null +++ b/client_flutter/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: android + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: ios + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: linux + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: macos + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: web + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + - platform: windows + create_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + base_revision: ff5b5b5fa6f35b717667719ddfdb1521d8bdd05a + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/client_flutter/.vscode/settings.json b/client_flutter/.vscode/settings.json new file mode 100644 index 0000000..318df94 --- /dev/null +++ b/client_flutter/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "dart.lineLength": 80, + "files.eol": "\n", + "[dart]": { + "editor.formatOnSave": true, + "editor.tabSize": 2, + "editor.rulers": [80], + "editor.insertSpaces": false, + "editor.detectIndentation": false + } + } \ No newline at end of file diff --git a/app_flutter/README.md b/client_flutter/README.md similarity index 94% rename from app_flutter/README.md rename to client_flutter/README.md index c83b3cd..f30c3e4 100644 --- a/app_flutter/README.md +++ b/client_flutter/README.md @@ -1,4 +1,4 @@ -# app_flutter +# client_flutter A new Flutter project. diff --git a/app_flutter/analysis_options.yaml b/client_flutter/analysis_options.yaml similarity index 93% rename from app_flutter/analysis_options.yaml rename to client_flutter/analysis_options.yaml index a7acf24..91b2419 100644 --- a/app_flutter/analysis_options.yaml +++ b/client_flutter/analysis_options.yaml @@ -8,6 +8,9 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml +analyzer: + exclude: + - "**/*.g.dart" linter: # The lint rules applied to this project can be customized in the @@ -22,6 +25,7 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + require_trailing_commas: true # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule diff --git a/app_flutter/android/.gitignore b/client_flutter/android/.gitignore similarity index 100% rename from app_flutter/android/.gitignore rename to client_flutter/android/.gitignore diff --git a/client_flutter/android/app/build.gradle b/client_flutter/android/app/build.gradle new file mode 100644 index 0000000..dec6843 --- /dev/null +++ b/client_flutter/android/app/build.gradle @@ -0,0 +1,79 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + +android { + namespace "kar_assistant" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.kara.karAssistant" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion 21 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { + release { + signingConfig signingConfigs.release + } + } +} + +flutter { + source '../..' +} + +dependencies {} diff --git a/app_flutter/android/app/src/debug/AndroidManifest.xml b/client_flutter/android/app/src/debug/AndroidManifest.xml similarity index 100% rename from app_flutter/android/app/src/debug/AndroidManifest.xml rename to client_flutter/android/app/src/debug/AndroidManifest.xml diff --git a/app_flutter/android/app/src/main/AndroidManifest.xml b/client_flutter/android/app/src/main/AndroidManifest.xml similarity index 78% rename from app_flutter/android/app/src/main/AndroidManifest.xml rename to client_flutter/android/app/src/main/AndroidManifest.xml index 41256c1..1839628 100644 --- a/app_flutter/android/app/src/main/AndroidManifest.xml +++ b/client_flutter/android/app/src/main/AndroidManifest.xml @@ -1,14 +1,10 @@ - + - - - + android:icon="@mipmap/launcher_icon"> CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - App Flutter + KarAssistant CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -13,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - app_flutter + KarAssistant CFBundlePackageType APPL CFBundleShortVersionString @@ -41,8 +41,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents diff --git a/app_flutter/ios/Runner/Runner-Bridging-Header.h b/client_flutter/ios/Runner/Runner-Bridging-Header.h similarity index 100% rename from app_flutter/ios/Runner/Runner-Bridging-Header.h rename to client_flutter/ios/Runner/Runner-Bridging-Header.h diff --git a/app_flutter/ios/RunnerTests/RunnerTests.swift b/client_flutter/ios/RunnerTests/RunnerTests.swift similarity index 100% rename from app_flutter/ios/RunnerTests/RunnerTests.swift rename to client_flutter/ios/RunnerTests/RunnerTests.swift diff --git a/client_flutter/lib/core/globals.dart b/client_flutter/lib/core/globals.dart new file mode 100644 index 0000000..f0dd0d7 --- /dev/null +++ b/client_flutter/lib/core/globals.dart @@ -0,0 +1,7 @@ +import 'package:http/http.dart' as http; + +String? envBaseUrl; +String? envMode; +String? tokenApi; +http.Client? clientTest; +String? clientToken; diff --git a/client_flutter/lib/core/models/conversation/message_conversation.dart b/client_flutter/lib/core/models/conversation/message_conversation.dart new file mode 100644 index 0000000..9c6e0c7 --- /dev/null +++ b/client_flutter/lib/core/models/conversation/message_conversation.dart @@ -0,0 +1,28 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'message_conversation.g.dart'; + +enum TypeConversation { + kara, + user, + recording, +} + +@JsonSerializable() +class MessageConversation { + MessageConversation( + {required this.type, required this.text, required this.urlImage,}); + + @JsonKey(name: "TYPE") + TypeConversation type; + + @JsonKey(name: "TEXT") + String text; + + @JsonKey(name: "IMAGESRC") + String urlImage; + + factory MessageConversation.fromJson(Map json) => + _$MessageConversationFromJson(json); + Map toJson() => _$MessageConversationToJson(this); +} diff --git a/client_flutter/lib/core/models/conversation/message_conversation.g.dart b/client_flutter/lib/core/models/conversation/message_conversation.g.dart new file mode 100644 index 0000000..71fa431 --- /dev/null +++ b/client_flutter/lib/core/models/conversation/message_conversation.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'message_conversation.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MessageConversation _$MessageConversationFromJson(Map json) => + MessageConversation( + type: $enumDecode(_$TypeConversationEnumMap, json['TYPE']), + text: json['TEXT'] as String, + urlImage: json['IMAGESRC'] as String, + ); + +Map _$MessageConversationToJson( + MessageConversation instance) => + { + 'TYPE': _$TypeConversationEnumMap[instance.type]!, + 'TEXT': instance.text, + 'IMAGESRC': instance.urlImage, + }; + +const _$TypeConversationEnumMap = { + TypeConversation.kara: 'kara', + TypeConversation.user: 'user', + TypeConversation.recording: 'recording', +}; diff --git a/client_flutter/lib/core/models/kara_response.dart b/client_flutter/lib/core/models/kara_response.dart new file mode 100644 index 0000000..f4ef22d --- /dev/null +++ b/client_flutter/lib/core/models/kara_response.dart @@ -0,0 +1,33 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'kara_response.g.dart'; + +@JsonSerializable() +class KaraResponse { + KaraResponse(); + + @JsonKey(name: "result") + late String result; + + @JsonKey(name: "lang") + late String? language; + + @JsonKey(name: "skill") + late String? skill; + + @JsonKey(name: "similarity") + late double similarity; + + @JsonKey(name: "bestPhrase") + late String bestPhrase; + + @JsonKey(name: "convToken") + late String? convToken; + + @JsonKey(name: "userToken") + late String? userToken; + + factory KaraResponse.fromJson(Map json) => + _$KaraResponseFromJson(json); + Map toJson() => _$KaraResponseToJson(this); +} diff --git a/app_flutter/lib/core/models/kara_response.g.dart b/client_flutter/lib/core/models/kara_response.g.dart similarity index 75% rename from app_flutter/lib/core/models/kara_response.g.dart rename to client_flutter/lib/core/models/kara_response.g.dart index 564cf7d..e49f85e 100644 --- a/app_flutter/lib/core/models/kara_response.g.dart +++ b/client_flutter/lib/core/models/kara_response.g.dart @@ -8,11 +8,12 @@ part of 'kara_response.dart'; KaraResponse _$KaraResponseFromJson(Map json) => KaraResponse() ..result = json['result'] as String - ..language = json['lang'] as String - ..skill = json['skill'] as String + ..language = json['lang'] as String? + ..skill = json['skill'] as String? ..similarity = (json['similarity'] as num).toDouble() ..bestPhrase = json['bestPhrase'] as String - ..token = json['token'] as String?; + ..convToken = json['convToken'] as String? + ..userToken = json['userToken'] as String?; Map _$KaraResponseToJson(KaraResponse instance) => { @@ -21,5 +22,6 @@ Map _$KaraResponseToJson(KaraResponse instance) => 'skill': instance.skill, 'similarity': instance.similarity, 'bestPhrase': instance.bestPhrase, - 'token': instance.token, + 'convToken': instance.convToken, + 'userToken': instance.userToken, }; diff --git a/client_flutter/lib/core/repository/client_repo.dart b/client_flutter/lib/core/repository/client_repo.dart new file mode 100644 index 0000000..6cbe573 --- /dev/null +++ b/client_flutter/lib/core/repository/client_repo.dart @@ -0,0 +1,16 @@ +import 'dart:convert'; +import 'package:kar_assistant/core/repository/client_repository.dart'; +import 'package:kar_assistant/services/http_repo.dart'; + +class ClientRepo implements ClientRepository { + @override + Future newToken(Map data) async { + try { + final response = + await HttpRepo().getRequestParams("api/client/newToken", data); + return json.decode(response.body); + } catch (err) { + rethrow; + } + } +} diff --git a/client_flutter/lib/core/repository/client_repository.dart b/client_flutter/lib/core/repository/client_repository.dart new file mode 100644 index 0000000..51ed3fa --- /dev/null +++ b/client_flutter/lib/core/repository/client_repository.dart @@ -0,0 +1,3 @@ +abstract class ClientRepository { + Future newToken(Map data); +} diff --git a/app_flutter/lib/core/repository/kara_repo.dart b/client_flutter/lib/core/repository/kara_repo.dart similarity index 50% rename from app_flutter/lib/core/repository/kara_repo.dart rename to client_flutter/lib/core/repository/kara_repo.dart index 1260df7..a7a2281 100644 --- a/app_flutter/lib/core/repository/kara_repo.dart +++ b/client_flutter/lib/core/repository/kara_repo.dart @@ -1,16 +1,17 @@ -import 'dart:convert'; - import 'package:kar_assistant/core/models/kara_response.dart'; import 'package:kar_assistant/core/repository/kara_repository.dart'; import 'package:kar_assistant/services/http_repo.dart'; class KaraRepo implements KaraRepository { @override - Future heyKara(Map data) async { + Future heyKara( + Map jsonData, + ) async { try { - final response = await HttpRepo().getRequestParams("api/heyKara", data); - final parsedResponse = KaraResponse.fromJson(json.decode(response.body)); - return parsedResponse; + Map value = + await HttpRepo().getRequestParamsSecure("api/heyKara", jsonData); + KaraResponse karaResponse = KaraResponse.fromJson(value); + return karaResponse; } catch (err) { rethrow; } diff --git a/client_flutter/lib/core/repository/kara_repository.dart b/client_flutter/lib/core/repository/kara_repository.dart new file mode 100644 index 0000000..bb01876 --- /dev/null +++ b/client_flutter/lib/core/repository/kara_repository.dart @@ -0,0 +1,3 @@ +abstract class KaraRepository { + Future heyKara(Map data); +} diff --git a/client_flutter/lib/core/repository/user_repo.dart b/client_flutter/lib/core/repository/user_repo.dart new file mode 100644 index 0000000..e15fc10 --- /dev/null +++ b/client_flutter/lib/core/repository/user_repo.dart @@ -0,0 +1,18 @@ +import 'package:kar_assistant/core/repository/user_repository.dart'; +import 'package:kar_assistant/services/http_repo.dart'; + +class UserRepo extends UserRepository { + @override + Future> getHistory() async { + try { + Map data = { + "test": 'bloup', + }; // empty because juste need DATE and date is filled inside ParamsSecure + Map value = + await HttpRepo().getRequestParamsSecure("api/user/history", data); + return value; + } catch (err) { + rethrow; + } + } +} diff --git a/client_flutter/lib/core/repository/user_repository.dart b/client_flutter/lib/core/repository/user_repository.dart new file mode 100644 index 0000000..fbbc110 --- /dev/null +++ b/client_flutter/lib/core/repository/user_repository.dart @@ -0,0 +1,3 @@ +abstract class UserRepository { + Future> getHistory(); +} diff --git a/client_flutter/lib/core/widgets/animation_widget/ripple_custom_animation.dart b/client_flutter/lib/core/widgets/animation_widget/ripple_custom_animation.dart new file mode 100644 index 0000000..8dd9b12 --- /dev/null +++ b/client_flutter/lib/core/widgets/animation_widget/ripple_custom_animation.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/core/widgets/animation_widget/ripple_custom_model.dart'; + +class RippleCustomAnimation extends StatefulWidget { + const RippleCustomAnimation({ + Key? key, + required this.child, + required this.size, + required this.minRadius, + this.color = Colors.teal, + this.duration = const Duration(milliseconds: 5000), + this.ripplesCount = 60, + }) : super(key: key); + + final Widget child; + final Size size; + final double minRadius; + final Color color; + final int ripplesCount; + final Duration duration; + + @override + State createState() => RippleCustomAnimationState(); +} + +class RippleCustomAnimationState extends State + with TickerProviderStateMixin { + Widget get child => widget.child; + double get radius => widget.minRadius; + Duration get duration => widget.duration; + Color get color => widget.color; + int get rippleCount => widget.ripplesCount; + AnimationController? animationController; + + @override + void initState() { + animationController = AnimationController(vsync: this, duration: duration); + super.initState(); + } + + @override + void dispose() { + animationController!.dispose(); + super.dispose(); + } + + void startAnimate() { + animationController!.repeat(); + } + + void stopAnimate() { + animationController!.reset(); + } + + @override + Widget build(BuildContext context) { + return SizedBox( + width: widget.size.width, + height: widget.size.height, + child: CustomPaint( + painter: AnimatedCircle(animationController, + minRadius: radius, + wavesCount: rippleCount + 2, + color: color, + key: UniqueKey(),), + child: child, + ),); + } +} diff --git a/client_flutter/lib/core/widgets/animation_widget/ripple_custom_model.dart b/client_flutter/lib/core/widgets/animation_widget/ripple_custom_model.dart new file mode 100644 index 0000000..4b858af --- /dev/null +++ b/client_flutter/lib/core/widgets/animation_widget/ripple_custom_model.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; + +class AnimatedCircle extends CustomPainter { + AnimatedCircle(this.animation, + {Key? key, + this.color = Colors.teal, + this.minRadius = 150, + this.wavesCount = 2,}) + : super(repaint: animation); + + final Color color; + final double minRadius; + final int wavesCount; + final Animation? animation; + + @override + void paint(Canvas canvas, Size size) { + final Rect rect = Rect.fromLTRB(0.0, 0.0, size.width, size.height); + for (int wave = 1; wave <= wavesCount; wave++) { + circle( + canvas: canvas, + rect: rect, + wave: wave, + value: animation!.value, + length: wavesCount, + minRadius: minRadius,); + } + } + + void circle( + {required Canvas canvas, + required Rect rect, + double? minRadius, + required int wave, + required double value, + int? length,}) { + Color myColor; + double r; + + if (wave != 0) { + double opecity = (1 - ((wave - 1) / length!) - value).clamp(0.0, 1.0); + myColor = color.withOpacity(opecity); + r = minRadius! * (1 + ((wave * value))) * value; + final Paint paint = Paint()..color = myColor; + canvas.drawCircle(rect.center, r, paint); + } + } + + @override + bool shouldRepaint(AnimatedCircle oldDelegate) => true; +} diff --git a/client_flutter/lib/core/widgets/border/message_border.dart b/client_flutter/lib/core/widgets/border/message_border.dart new file mode 100644 index 0000000..007644c --- /dev/null +++ b/client_flutter/lib/core/widgets/border/message_border.dart @@ -0,0 +1,160 @@ +import 'package:flutter/material.dart'; + +class MessageBorder extends ShapeBorder { + final bool usePadding; + + const MessageBorder({this.usePadding = true}); + + @override + EdgeInsetsGeometry get dimensions => + EdgeInsets.only(bottom: usePadding ? 20 : 0); + + @override + Path getInnerPath(Rect rect, {TextDirection? textDirection}) => Path(); + + @override + Path getOuterPath(Rect rect, {TextDirection? textDirection}) { + rect = Rect.fromPoints(rect.topLeft, rect.bottomRight - const Offset(0, 20)); + return Path() + ..addRRect( + RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2)),) + ..moveTo(rect.bottomCenter.dx - 10, rect.bottomCenter.dy) + ..relativeLineTo(10, 20) + ..relativeLineTo(10, -20) + ..close(); + } + + @override + void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) {} + + @override + ShapeBorder scale(double t) => this; +} + +// class MessageBorder extends OutlinedBorder { +// final BorderRadius borderRadius; +// final Color backgroundColor; +// final String trianglePositon; +// const MessageBorder({ +// super.side = BorderSide.none, +// this.borderRadius = BorderRadius.zero, +// this.trianglePositon = 'right', +// required this.backgroundColor, + +// }); + +// @override +// MessageBorder copyWith( +// {BorderSide? side, BorderRadius? borderRadius, Color? backgroundColor}) { +// return MessageBorder( +// borderRadius: borderRadius ?? this.borderRadius, +// side: side ?? this.side, +// backgroundColor: backgroundColor ?? this.backgroundColor, +// ); +// } + +// @override +// ShapeBorder scale(double t) { +// return MessageBorder( +// side: side.scale(t), +// borderRadius: borderRadius * t, +// backgroundColor: backgroundColor, +// ); +// } + +// @override +// EdgeInsetsGeometry get dimensions => const EdgeInsets.all(8.0); + +// @override +// Path getInnerPath(Rect rect, {TextDirection? textDirection}) { +// return Path() +// ..addRRect(borderRadius +// .resolve(textDirection) +// .toRRect(rect) +// .deflate(side.width)); +// } + +// @override +// Path getOuterPath(Rect rect, {TextDirection? textDirection}) { +// return Path()..addRRect(borderRadius.resolve(textDirection).toRRect(rect)); +// } + +// Offset getSideRect(Rect rect){ +// if(trianglePositon == 'left'){ +// return rect.bottomLeft; +// }else{ +// return rect.bottomRight; +// } +// } + +// void _paintTriangle(Canvas canvas, Rect rect, int triangleVerticalDistance) { +// final Paint tranglePaint = Paint(); +// tranglePaint.color = backgroundColor; +// Path path = Path(); +// if(trianglePositon == 'left'){ +// path.moveTo(rect.bottomLeft.dx, +// rect.bottomLeft.dy - borderRadius.bottomLeft.x - 1); +// path.lineTo(rect.bottomLeft.dx + triangleVerticalDistance, +// rect.bottomLeft.dy + triangleVerticalDistance); + +// }else { +// path.moveTo(rect.bottomRight.dx - borderRadius.bottomRight.x - 1, +// rect.bottomRight.dy); +// path.lineTo(rect.bottomRight.dx + triangleVerticalDistance, +// rect.bottomRight.dy + triangleVerticalDistance); +// path.lineTo(rect.bottomRight.dx, +// rect.bottomRight.dy - borderRadius.bottomRight.y - 1); +// } +// path.close(); +// canvas.drawPath(path, tranglePaint); + +// } + +// void _paintTriangleSide( +// Canvas canvas, Rect rect, int triangleVerticalDistance) { +// final Paint trangleSide = Paint(); +// trangleSide.color = side.color; +// trangleSide.strokeWidth = side.width; +// canvas.drawLine( +// Offset(rect.bottomRight.dx - borderRadius.bottomRight.x, +// rect.bottomRight.dy - (side.width / 2)), +// Offset(rect.bottomRight.dx + triangleVerticalDistance + 1, +// rect.bottomRight.dy + triangleVerticalDistance + 1), +// trangleSide, +// ); +// canvas.drawLine( +// Offset(rect.bottomRight.dx + 4, rect.bottomRight.dy + 4), +// Offset(rect.bottomRight.dx - (side.width / 2), +// rect.bottomRight.dy - borderRadius.bottomRight.y), +// trangleSide, +// ); +// } + +// @override +// void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) { +// const int triangleVerticalDistance = 3; +// final Paint borderPaint = Paint()..color = side.color; +// switch (side.style) { +// case BorderStyle.none: +// _paintTriangle(canvas, rect, triangleVerticalDistance); +// break; +// case BorderStyle.solid: +// final double width = side.width; + +// if (width == 0.0) { +// canvas.drawRRect(borderRadius.resolve(textDirection).toRRect(rect), +// side.toPaint()); + +// _paintTriangle(canvas, rect, triangleVerticalDistance); +// } else { +// final RRect outer = borderRadius.resolve(textDirection).toRRect(rect); +// final RRect inner = outer.deflate(width); +// canvas.drawDRRect(outer, inner, borderPaint); + +// _paintTriangle(canvas, rect, triangleVerticalDistance); + +// _paintTriangleSide(canvas, rect, triangleVerticalDistance); +// } +// } +// } +// } diff --git a/client_flutter/lib/core/widgets/border/message_bubble.dart b/client_flutter/lib/core/widgets/border/message_bubble.dart new file mode 100644 index 0000000..ab18227 --- /dev/null +++ b/client_flutter/lib/core/widgets/border/message_bubble.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/core/widgets/border/message_border.dart'; + +class MessageBubble extends StatelessWidget { + final String msg; + const MessageBubble({super.key, required this.msg}); + + @override + Widget build(BuildContext context) { + return Align( + alignment: Alignment.center, + child: Container( + constraints: const BoxConstraints(minWidth: 50), + decoration: ShapeDecoration( + color: Theme.of(context).colorScheme.primary, + shape: const MessageBorder(), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Text( + msg, + style: const TextStyle( + color: Colors.white, + fontSize: 15.0, + ), + ), + ), + ), + ); + } +} diff --git a/client_flutter/lib/core/widgets/work_in_progress.dart b/client_flutter/lib/core/widgets/work_in_progress.dart new file mode 100644 index 0000000..9721e02 --- /dev/null +++ b/client_flutter/lib/core/widgets/work_in_progress.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; + +class WorkInProgress extends StatelessWidget { + const WorkInProgress({super.key}); + + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + MdiIcons.trafficCone, + size: 45, + color: Theme.of(context).primaryColor, + ), + const Text('Work in Progress'), + ], + ), + ); + } +} diff --git a/client_flutter/lib/main.dart b/client_flutter/lib/main.dart new file mode 100644 index 0000000..555f7e4 --- /dev/null +++ b/client_flutter/lib/main.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/home_page/view/home_page.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await UtilsController().initEnv(); + 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: 'KarAssistant', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + useMaterial3: true, + ), + home: const HomePage(), + ); + } +} diff --git a/client_flutter/lib/screens/actions_page/view/actions_page.dart b/client_flutter/lib/screens/actions_page/view/actions_page.dart new file mode 100644 index 0000000..869849f --- /dev/null +++ b/client_flutter/lib/screens/actions_page/view/actions_page.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/the_only_one.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/view/the_only_one_play_screen.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/view/touch_play_screen.dart'; + +class ActionsPage extends StatefulWidget { + const ActionsPage({super.key}); + + @override + State createState() => _ActionsPageState(); +} + +class _ActionsPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Theme( + data: ThemeData( + useMaterial3: true, + textTheme: GoogleFonts.pressStart2pTextTheme().apply( + bodyColor: const Color(0xff184e77), + displayColor: const Color(0xff184e77), + ), + ), + child: ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const TouchPlayScreen(), + ), + ); + }, + child: const Text('Dont Fall Game'), + ), + ), + SizedBox( + height: 40, + ), + Theme( + data: ThemeData( + useMaterial3: true, + textTheme: GoogleFonts.pressStart2pTextTheme().apply( + bodyColor: const Color(0xff184e77), + displayColor: const Color(0xff184e77), + ), + ), + child: ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const TheOnlyOnePlayScreen(), + ), + ); + }, + child: const Text('The Only One'), + ), + ), + ], + ), + ), + ); + } +} diff --git a/client_flutter/lib/screens/history_page/view/history_page.dart b/client_flutter/lib/screens/history_page/view/history_page.dart new file mode 100644 index 0000000..7189bd6 --- /dev/null +++ b/client_flutter/lib/screens/history_page/view/history_page.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:kar_assistant/core/models/conversation/message_conversation.dart'; +import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; + +class HystoryPage extends StatefulWidget { + final KaraController karaController; + const HystoryPage({required this.karaController, super.key}); + + @override + State createState() => _HystoryPageState(); +} + +class _HystoryPageState extends State { + @override + void initState() { + super.initState(); + // UserRepo().getHistory(); + } + + @override + Widget build(BuildContext context) { + List listMessages = widget.karaController.listResponse; + final colorScheme = Theme.of(context).colorScheme; + return Center( + child: ListView.builder( + reverse: true, + itemCount: listMessages.length, + shrinkWrap: true, + padding: const EdgeInsets.only(top: 10, bottom: 30), + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.only( + left: listMessages[index].type == TypeConversation.kara ? 14 : 70, + right: + listMessages[index].type == TypeConversation.kara ? 70 : 14, + top: 10, + bottom: 10, + ), + child: Align( + alignment: (listMessages[index].type == TypeConversation.kara + ? Alignment.topLeft + : Alignment.topRight), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: (listMessages[index].type == TypeConversation.kara + ? colorScheme.primary + : Colors.blue[200]), + ), + padding: const EdgeInsets.all(16), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + child: Text( + listMessages[index].text, + style: TextStyle( + fontSize: 15, + color: + listMessages[index].type == TypeConversation.kara + ? Colors.white + : null, + ), + ), + ), + listMessages[index].type == TypeConversation.recording + ? const SpinKitWave( + color: Colors.white, + size: 10, + ) + : Container(), + ], + ), + ), + ), + ); + }, + ), + ); + } +} diff --git a/client_flutter/lib/screens/home_page/controller/kara_controller.dart b/client_flutter/lib/screens/home_page/controller/kara_controller.dart new file mode 100644 index 0000000..7d16f89 --- /dev/null +++ b/client_flutter/lib/screens/home_page/controller/kara_controller.dart @@ -0,0 +1,34 @@ +import 'package:flutter/foundation.dart'; +import 'package:kar_assistant/core/models/conversation/message_conversation.dart'; +import 'package:kar_assistant/core/models/kara_response.dart'; +import 'package:kar_assistant/core/repository/kara_repo.dart'; + +class KaraController { + final KaraRepo karaRepo = KaraRepo(); + KaraResponse? karaLastResponse; + String lastWords = ''; + List listResponse = []; + + Future askedKara(String text) async { + Map json = { + 'query': text, + }; + + KaraResponse result; + result = await karaRepo.heyKara(json); + if (kDebugMode) { + print(result.toJson()); + } + karaLastResponse = result; + return result; + } + + bool verifIsToken() { + if (karaLastResponse != null) { + if (karaLastResponse!.convToken != null) { + return true; + } + } + return false; + } +} diff --git a/client_flutter/lib/screens/home_page/controller/user_controller.dart b/client_flutter/lib/screens/home_page/controller/user_controller.dart new file mode 100644 index 0000000..210c142 --- /dev/null +++ b/client_flutter/lib/screens/home_page/controller/user_controller.dart @@ -0,0 +1,13 @@ +import 'package:kar_assistant/core/repository/user_repo.dart'; + +class UserController { + Map? currentHistory; + Future initInfoUser() async { + // await Future.wait([loadHistory()]); + } + + Future loadHistory() async { + Map result = await UserRepo().getHistory(); + currentHistory = result; + } +} diff --git a/client_flutter/lib/screens/home_page/view/discord_dialogue_configure.dart b/client_flutter/lib/screens/home_page/view/discord_dialogue_configure.dart new file mode 100644 index 0000000..01a3280 --- /dev/null +++ b/client_flutter/lib/screens/home_page/view/discord_dialogue_configure.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/core/widgets/work_in_progress.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; + +class DiscordDialogConfigure extends StatelessWidget { + const DiscordDialogConfigure({super.key}); + + @override + Widget build(BuildContext context) { + return AlertDialog( + titleTextStyle: const TextStyle(fontSize: 20, color: Colors.black), + title: const Row( + children: [ + Icon( + MdiIcons.discord, + color: Color(0xff5865F2), + size: 25, + ), + Text( + 'Lier votre compte discord', + ), + ], + ), + content: const SizedBox( + width: 150, + height: 150, + child: WorkInProgress(), + ), + actionsAlignment: MainAxisAlignment.start, + actions: [ + ElevatedButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('Annuler'), + ), + ], + ); + } +} diff --git a/client_flutter/lib/screens/home_page/view/home_page.dart b/client_flutter/lib/screens/home_page/view/home_page.dart new file mode 100644 index 0000000..11bd406 --- /dev/null +++ b/client_flutter/lib/screens/home_page/view/home_page.dart @@ -0,0 +1,177 @@ +import 'package:flutter/material.dart'; +import 'package:animations/animations.dart'; +import 'package:kar_assistant/screens/actions_page/view/actions_page.dart'; +import 'package:kar_assistant/screens/history_page/view/history_page.dart'; +import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; +import 'package:kar_assistant/screens/home_page/controller/user_controller.dart'; +import 'package:kar_assistant/screens/home_page/view/kara_talking.dart'; +import 'package:kar_assistant/screens/home_page/view/my_profil.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + final String title = " title"; + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State with RestorationMixin { + final RestorableInt _currentIndexPage = RestorableInt(0); + final PageController controllerPage = PageController(initialPage: 0); + late KaraController karaController; + late UserController userController; + + @override + void initState() { + print('restart App'); + karaController = KaraController(); + userController = UserController(); + UtilsController().verifTokenExistStorage().then((value) { + userController.initInfoUser(); + }); + super.initState(); + } + + refresh() { + setState(() {}); + } + + @override + String get restorationId => 'bottom_nav_bar'; + + @override + void restoreState(RestorationBucket? oldBucket, bool initialRestore) { + registerForRestoration(_currentIndexPage, 'bottom_navigation_tab_index'); + } + + @override + Widget build(BuildContext context) { + final List bottomNavigationBarItems = + [ + BottomNavigationBarItem( + icon: Icon( + Icons.list_sharp, + size: 35, + color: Theme.of(context).colorScheme.onPrimary.withOpacity(0.38), + ), + activeIcon: Icon( + Icons.list_sharp, + size: 35, + color: Theme.of(context).colorScheme.onPrimary, + ), + label: 'Historique', + ), + BottomNavigationBarItem( + icon: Icon( + Icons.pending_actions, + size: 35, + color: Theme.of(context).colorScheme.onPrimary.withOpacity(0.38), + ), + activeIcon: Icon( + Icons.pending_actions, + size: 35, + color: Theme.of(context).colorScheme.onPrimary, + ), + label: 'Actions', + ), + ]; + + final colorScheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Scaffold( + appBar: AppBar( + title: const Text( + "Karasistant", + style: TextStyle(color: Colors.white), + ), + backgroundColor: colorScheme.primary, + automaticallyImplyLeading: false, + actions: const [MyProfil()], + ), + body: Center( + child: PageTransitionSwitcher( + transitionBuilder: (child, animation, secondaryAnimation) { + return FadeThroughTransition( + animation: animation, + secondaryAnimation: secondaryAnimation, + child: child, + ); + }, + child: PageView( + controller: controllerPage, + onPageChanged: (newIndex) { + setState(() { + _currentIndexPage.value = newIndex; + }); + }, + children: [ + HystoryPage( + karaController: karaController, + ), + const ActionsPage(), + ], + ), + ), + ), + floatingActionButton: KaraTalking( + karaController, + updateParents: refresh, + currentIndexPage: _currentIndexPage.value, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: BottomAppBar( + color: Theme.of(context).colorScheme.primary, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: List.generate(bottomNavigationBarItems.length + 1, (index) { + int usedIndex = index >= 2 ? index - 1 : index; + BottomNavigationBarItem item = bottomNavigationBarItems[usedIndex]; + if (index == 1) { + return const SizedBox(width: 150); + } + return InkResponse( + onTap: () { + controllerPage.animateToPage( + usedIndex, + duration: (Duration( + milliseconds: + ((_currentIndexPage.value - usedIndex).abs() * 200), + )), + curve: Curves.linear, + ); + }, + enableFeedback: true, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.topCenter, + heightFactor: 1.0, + child: _currentIndexPage.value == usedIndex + ? item.activeIcon + : item.icon, + ), + _currentIndexPage.value == usedIndex + ? Text( + item.label!, + style: TextStyle( + fontSize: textTheme.bodySmall!.fontSize!, + color: colorScheme.onPrimary, + ), + ) + : Container(), + ], + ), + ), + ); + }), + ), + ), + ); + } +} diff --git a/client_flutter/lib/screens/home_page/view/kara_talking.dart b/client_flutter/lib/screens/home_page/view/kara_talking.dart new file mode 100644 index 0000000..f61298c --- /dev/null +++ b/client_flutter/lib/screens/home_page/view/kara_talking.dart @@ -0,0 +1,278 @@ +import 'dart:async'; +import 'dart:io' show Platform; +import 'package:flutter/foundation.dart' show kDebugMode, kIsWeb; +import 'package:flutter/material.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:kar_assistant/core/models/conversation/message_conversation.dart'; +import 'package:kar_assistant/core/models/kara_response.dart'; +import 'package:kar_assistant/core/widgets/animation_widget/ripple_custom_animation.dart'; +import 'package:kar_assistant/core/widgets/border/message_bubble.dart'; +import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; +import 'package:speech_to_text/speech_recognition_result.dart'; +import 'package:speech_to_text/speech_to_text.dart'; + +class KaraTalking extends StatefulWidget { + final KaraController karaController; + final int currentIndexPage; + final Function() updateParents; + const KaraTalking( + this.karaController, { + required this.updateParents, + required this.currentIndexPage, + super.key, + }); + + @override + _KaraTalkingState createState() => _KaraTalkingState(); +} + +enum TtsState { playing, stopped } + +class _KaraTalkingState extends State { + final SpeechToText _speechToText = SpeechToText(); + bool showKaraAnswer = false; + GlobalKey animationKey = + GlobalKey(); + late FlutterTts flutterTts; + String? language; + String? engine; + double volume = 1.0; + double pitch = 1.0; + double rate = 0.6; + bool isCurrentLanguageInstalled = false; + + TtsState ttsState = TtsState.stopped; + + get isPlaying => ttsState == TtsState.playing; + // get isStopped => ttsState == TtsState.stopped; + // get isPaused => ttsState == TtsState.paused; + // get isContinued => ttsState == TtsState.continued; + + bool get isIOS => !kIsWeb && Platform.isIOS; + bool get isAndroid => !kIsWeb && Platform.isAndroid; + bool get isWindows => !kIsWeb && Platform.isWindows; + bool get isWeb => kIsWeb; + + @override + initState() { + super.initState(); + _initSpeech(); + initTts(); + } + + // ear Section + void _initSpeech() async { + await _speechToText.initialize( + onError: (errorNotification) => animationKey.currentState!.stopAnimate(), + onStatus: (status) { + if (status == 'notListening') { + animationKey.currentState!.stopAnimate(); + } + }, + ); + setState(() {}); + } + + void _startListening() async { + animationKey.currentState!.startAnimate(); + await _speechToText.listen( + onResult: _onSpeechResult, + localeId: 'FR', + listenMode: ListenMode.dictation, + cancelOnError: true, + ); + setState(() {}); + } + + void _stopListening() async { + widget.karaController.listResponse.removeLast(); + animationKey.currentState!.stopAnimate(); + await _speechToText.stop(); + } + + /// This is the callback that the SpeechToText plugin calls when + /// the platform returns recognized words. + void _onSpeechResult(SpeechRecognitionResult result) { + setState(() { + widget.karaController.lastWords = result.recognizedWords; + widget.updateParents(); + }); + if (result.finalResult == true) { + MessageConversation saidUSer = MessageConversation( + type: TypeConversation.user, + text: result.recognizedWords, + urlImage: '', + ); + widget.karaController.listResponse.insertAll(0, [saidUSer]); + animationKey.currentState!.stopAnimate(); + widget.updateParents(); + widget.karaController + .askedKara(result.recognizedWords) + .then((KaraResponse response) { + setState(() { + showKaraAnswer = true; + MessageConversation saidKara = MessageConversation( + type: TypeConversation.kara, + text: response.result, + urlImage: '', + ); + widget.karaController.listResponse.insertAll(0, [saidKara]); + widget.updateParents(); + + _speak(response.result).then( + (value) => { + Future.delayed( + const Duration(seconds: 4), + () { + if (mounted) { + setState(() { + showKaraAnswer = false; + }); + } + }, + ), + }, + ); + }); + }); + } + } + + //_____________________________________// + //talk Section + initTts() { + flutterTts = FlutterTts(); + + _setAwaitOptions(); + + if (isAndroid) { + _getDefaultEngine().then( + (defaultEngine) { + flutterTts.setEngine(defaultEngine); + }, + ); + + // _getDefaultVoice().then( + // (defaultLanguage) { + // flutterTts.setVoice(defaultLanguage); + // }, + // ); + } + + flutterTts.setStartHandler(() { + setState(() { + if (kDebugMode) {} + ttsState = TtsState.playing; + }); + }); + + if (isAndroid) { + flutterTts.setInitHandler(() { + setState(() {}); + }); + } + + flutterTts.setCompletionHandler(() { + setState(() { + ttsState = TtsState.stopped; + if (widget.karaController.verifIsToken()) { + _startListening(); + } + }); + }); + + flutterTts.setErrorHandler((msg) { + setState(() { + ttsState = TtsState.stopped; + }); + }); + } + + Future _getDefaultEngine() async { + var engine = await flutterTts.getDefaultEngine; + if (engine != null) { + return engine; + } + } + + Future _getDefaultVoice() async { + var voice = await flutterTts.getVoices; + return voice; + } + + Future _speak(String? textToSpeak) async { + await flutterTts.setVolume(volume); + await flutterTts.setSpeechRate(rate); + await flutterTts.setPitch(pitch); + + if (textToSpeak != null) { + if (textToSpeak.isNotEmpty) { + await flutterTts.speak(textToSpeak); + } + } + } + + Future _setAwaitOptions() async { + await flutterTts.awaitSpeakCompletion(true); + } + + @override + void dispose() { + super.dispose(); + flutterTts.stop(); + } + + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + showKaraAnswer && widget.currentIndexPage != 0 + ? MessageBubble( + msg: widget.karaController.listResponse[0].text, + ) + : Container(), + RippleCustomAnimation( + key: animationKey, + ripplesCount: 7, + size: const Size(100, 100), + minRadius: 80, + color: Theme.of(context).colorScheme.primary, + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + shape: BoxShape.circle, + ), + child: InkWell( + child: const CircleAvatar( + backgroundColor: Colors.white, + backgroundImage: AssetImage('image/kara_PP_circle.png'), + maxRadius: 55, + ), + onTapDown: (TapDownDetails details) { + if (_speechToText.isListening) { + _stopListening(); + } else { + _startListening(); + } + setState(() {}); + }, + ), + ), + ), + const Padding(padding: EdgeInsets.symmetric(vertical: 16)), + // Container( + // padding: const EdgeInsets.all(16), + // child: Text( + // _speechToText.isListening + // ? _lastWords + // : _speechEnabled + // ? '' + // : 'Impossible de discuter avec kara', + // ), + // ), + ], + ); + } +} diff --git a/client_flutter/lib/screens/home_page/view/my_profil.dart b/client_flutter/lib/screens/home_page/view/my_profil.dart new file mode 100644 index 0000000..0c55651 --- /dev/null +++ b/client_flutter/lib/screens/home_page/view/my_profil.dart @@ -0,0 +1,85 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/home_page/view/discord_dialogue_configure.dart'; +import 'package:kar_assistant/screens/options_page/view/options_page.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; + +class MyProfil extends StatefulWidget { + const MyProfil({super.key}); + + @override + State createState() => _MyProfilState(); +} + +class _MyProfilState extends State { + bool profilLoaded = false; + + PopupMenuItem buildMenuItem({ + required String title, + required IconData iconData, + Color? color, + }) { + return PopupMenuItem( + value: title, + height: 50, + child: Row( + children: [ + Expanded(child: Text(title)), + Icon( + iconData, + color: color ?? Colors.blue, + size: 25, + ), + ], + ), + ); + } + + List> getMenu() { + List> list = []; + list.add( + buildMenuItem( + title: 'Discord', + iconData: MdiIcons.discord, + color: const Color(0xff5865F2), + ), + ); + list.add(buildMenuItem(title: 'Options', iconData: MdiIcons.cogOutline)); + return list; + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: PopupMenuButton( + offset: const Offset(0, 60), + itemBuilder: (ctx) => getMenu(), + onSelected: (value) { + switch (value) { + case 'Discord': + showDialog( + context: context, + builder: (BuildContext context) { + return const DiscordDialogConfigure(); + }, + ); + break; + case 'Options': + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const OptionsPage(), + ), + ); + break; + } + }, + child: CircleAvatar( + child: profilLoaded + ? const Icon(MdiIcons.account) + : const Icon(MdiIcons.accountAlert), + ), + ), + ); + } +} diff --git a/client_flutter/lib/screens/my_games/the_only_one/components/components.dart b/client_flutter/lib/screens/my_games/the_only_one/components/components.dart new file mode 100644 index 0000000..4af3a70 --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/components/components.dart @@ -0,0 +1 @@ +export 'play_area.dart'; diff --git a/client_flutter/lib/screens/my_games/the_only_one/components/finger.dart b/client_flutter/lib/screens/my_games/the_only_one/components/finger.dart new file mode 100644 index 0000000..73646fc --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/components/finger.dart @@ -0,0 +1,70 @@ +import 'dart:math'; +import 'package:flame/components.dart'; +import 'package:flame/effects.dart'; +import 'package:flame/events.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/the_only_one.dart'; +import 'package:flame/game.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/material.dart' hide Draggable; + +class Finger extends SpriteComponent + with DragCallbacks, HasGameReference { + Finger({ + required Vector2 position, + required Vector2 size, + required this.spriteFinger, + required this.paint, + required this.color, + }) : super( + sprite: spriteFinger, + size: size, + paint: paint, + // position to the center of the finger + position: position, + anchor: Anchor.center, + ); + + Sprite spriteFinger; + Paint paint; + Color color; + bool _isDragged = false; + + final effect = ColorEffect( + const Color(0xFF00FF00), + EffectController(duration: 1.5), + opacityTo: 0.8, + ); + + @override + void onDragStart(DragStartEvent event) { + super.onDragStart(event); + _isDragged = true; + + priority = 10; + } + + @override + void onDragUpdate(DragUpdateEvent event) { + position += event.localDelta; + } + + @override + void onDragEnd(DragEndEvent event) { + super.onDragEnd(event); + print('dragEnd'); + _isDragged = false; + removeFromParent(); + game.fingers.removeWhere((key, value) => value == this); + print(game.fingers); + priority = 0; + } + + @override + void render(Canvas canvas) { + super.render(canvas); + if (_isDragged) { + } else { + paint.color = Colors.blue; + } + } +} diff --git a/client_flutter/lib/screens/my_games/the_only_one/components/play_area.dart b/client_flutter/lib/screens/my_games/the_only_one/components/play_area.dart new file mode 100644 index 0000000..24f7302 --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/components/play_area.dart @@ -0,0 +1,81 @@ +import 'dart:async'; + +import 'package:flame/components.dart'; +import 'package:flame/collisions.dart'; +import 'package:flame/effects.dart'; +import 'package:flame/events.dart'; +import 'package:flame/extensions.dart'; +import 'package:flame/geometry.dart'; +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/components/finger.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/the_only_one.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/touch_play.dart'; +import 'dart:math'; + +class PlayArea extends RectangleComponent + with TapCallbacks, HasGameReference { + PlayArea({required this.fingerSprite}) + : super( + paint: Paint()..color = const Color(0xfff2e8cf), + ); + + Sprite fingerSprite; + final _paint = Paint()..color = const Color(0x448BA8FF); + + @override + void render(Canvas canvas) { + canvas.drawRect(size.toRect(), _paint); + } + + @override + void onTapDown(TapDownEvent event) { + // game.fingers.map((key,value) { return {key,vlaue} }.tolist) + // Color randomColor = .where((Color color) => () ); + Finger finger = Finger( + color: game.listColor.random(), + position: event.canvasPosition, + size: Vector2(80, 80), + spriteFinger: fingerSprite, + paint: Paint() + ..color = const Color(0xff1e6091) + ..style = PaintingStyle.fill, + ); + + final colorEffect = ColorEffect( + finger.color, + EffectController( + alternate: true, + infinite: true, + duration: 2, + reverseDuration: 2, + ), + opacityFrom: 0.1, + opacityTo: 0.9, + ); + + finger.add(colorEffect); + + game.fingers[event.pointerId] = finger; + game.add(finger); + } + + @override + void onLongTapDown(TapDownEvent event) {} + + @override + void onTapUp(TapUpEvent event) { + game.remove(game.fingers[event.pointerId]!); + game.fingers.remove(event.pointerId); + } + + @override + void onTapCancel(TapCancelEvent event) { + print('tapCancel'); + } + + @override + FutureOr onLoad() async { + super.onLoad(); + size = Vector2(game.width, game.height); + } +} diff --git a/client_flutter/lib/screens/my_games/the_only_one/config.dart b/client_flutter/lib/screens/my_games/the_only_one/config.dart new file mode 100644 index 0000000..f5b6828 --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/config.dart @@ -0,0 +1,3 @@ +const gameWidth = 400.0; +const gameHeight = 900.0; +const fingerRadius = gameWidth * 0.20; diff --git a/client_flutter/lib/screens/my_games/the_only_one/the_only_one.dart b/client_flutter/lib/screens/my_games/the_only_one/the_only_one.dart new file mode 100644 index 0000000..bfb2a7a --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/the_only_one.dart @@ -0,0 +1,61 @@ +import 'dart:async'; + +import 'package:flame/components.dart'; +import 'package:flame/game.dart'; +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/components/finger.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/components/play_area.dart'; + +import 'package:kar_assistant/screens/my_games/the_only_one/config.dart'; + +enum PlayState { welcome, playing, gameOver } + +class TheOnlyOne extends FlameGame { + TheOnlyOne() + : super( + camera: CameraComponent.withFixedResolution( + width: gameWidth, + height: gameHeight, + ), + ); + final List listColor = [ + Colors.red, + // Colors.blue.shade300, + // Colors.blue.shade900, + // Colors.deepPurple, + Colors.purple.shade900, + Colors.orange.shade800, + Colors.green.shade600, + ]; + final Map fingers = {}; + late Sprite fingerSprite; + double get width => size.x; + double get height => size.y; + late PlayState _playState; + + PlayState get playState => _playState; + + set playState(PlayState playState) { + _playState = playState; + switch (playState) { + case PlayState.welcome: + case PlayState.gameOver: + case PlayState.playing: + print('todo'); + } + } + + @override + FutureOr onLoad() async { + final fingerImage = await images.load('finger_print.png'); + fingerSprite = Sprite(fingerImage); + super.onLoad(); + + camera.viewfinder.anchor = Anchor.topLeft; + world.add(PlayArea(fingerSprite: fingerSprite)); + debugMode = false; + } + + @override + Color backgroundColor() => Colors.black; +} diff --git a/client_flutter/lib/screens/my_games/the_only_one/view/the_only_one_play_screen.dart b/client_flutter/lib/screens/my_games/the_only_one/view/the_only_one_play_screen.dart new file mode 100644 index 0000000..26b493f --- /dev/null +++ b/client_flutter/lib/screens/my_games/the_only_one/view/the_only_one_play_screen.dart @@ -0,0 +1,58 @@ +import 'package:flame/game.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +import 'package:kar_assistant/screens/my_games/the_only_one/config.dart'; +import 'package:kar_assistant/screens/my_games/the_only_one/the_only_one.dart'; +import 'package:flame/flame.dart'; +import 'package:flame/sprite.dart'; + +class TheOnlyOnePlayScreen extends StatefulWidget { + const TheOnlyOnePlayScreen({super.key}); + + @override + State createState() => _MyGameScreenState(); +} + +class _MyGameScreenState extends State { + late final TheOnlyOne game; + + @override + void initState() { + super.initState(); + game = TheOnlyOne(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Theme( + data: ThemeData( + textTheme: GoogleFonts.pressStart2pTextTheme().apply( + bodyColor: const Color(0xff184e77), + displayColor: const Color(0xff184e77), + ), + ), + child: Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color.fromARGB(255, 55, 120, 67), + Color.fromARGB(255, 100, 68, 35), + ], + ), + ), + child: SizedBox( + width: gameWidth, + height: gameHeight, + child: GameWidget( + game: game, + ), + ), + ), + ), + ); + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/components/components.dart b/client_flutter/lib/screens/my_games/touch_play/components/components.dart new file mode 100644 index 0000000..81e8f68 --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/components/components.dart @@ -0,0 +1,3 @@ +export 'play_area.dart'; +export 'finger.dart'; +export 'raquette.dart'; diff --git a/client_flutter/lib/screens/my_games/touch_play/components/finger.dart b/client_flutter/lib/screens/my_games/touch_play/components/finger.dart new file mode 100644 index 0000000..8a3d9d4 --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/components/finger.dart @@ -0,0 +1,77 @@ +import 'package:flame/collisions.dart'; +import 'package:flame/components.dart'; +import 'package:flame/effects.dart'; +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/components/components.dart'; + +import '../touch_play.dart'; + +class Finger extends CircleComponent + with CollisionCallbacks, HasGameReference { + Finger({ + required this.velocity, + required super.position, + required double radius, + required this.paintFinger, + }) : super( + radius: radius, + anchor: Anchor.center, + paint: paintFinger, + children: [ + CircleHitbox(), + ], + ); + final Vector2 velocity; + Paint paintFinger; + + @override + void update(double dt) { + super.update(dt); + position += velocity * dt; + } + + @override + void onCollisionStart( + Set intersectionPoints, + PositionComponent other, + ) { + super.onCollisionStart(intersectionPoints, other); + if (other is PlayArea) { + if (intersectionPoints.first.y <= 0) { + velocity.y = -velocity.y; + paintFinger.color = Colors.red; + } else if (intersectionPoints.first.x <= 0) { + velocity.x = -velocity.x; + paintFinger.color = Colors.red; + } else if (intersectionPoints.first.x >= game.width) { + velocity.x = -velocity.x; + paintFinger.color = Colors.red; + } else if (intersectionPoints.first.y >= game.height) { + add( + RemoveEffect( + delay: 0.45, + onComplete: () { + // Modify from here + game.playState = PlayState.gameOver; + }, + ), + ); + } + } else if (other is Raquette) { + game.score.value++; + add( + GlowEffect( + 2.0, + EffectController(duration: 0.6, reverseDuration: 0.6), + style: BlurStyle.normal, + ), + ); + velocity.y = -velocity.y; + velocity.x = velocity.x + + (position.x - other.position.x) / other.size.x * game.width * 0.3; + paintFinger.color = Colors.green; + } else { + debugPrint('collision with $other'); + } + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/components/play_area.dart b/client_flutter/lib/screens/my_games/touch_play/components/play_area.dart new file mode 100644 index 0000000..5bc5fb8 --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/components/play_area.dart @@ -0,0 +1,20 @@ +import 'dart:async'; + +import 'package:flame/components.dart'; +import 'package:flame/collisions.dart'; +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/touch_play.dart'; + +class PlayArea extends RectangleComponent with HasGameReference { + PlayArea() + : super( + paint: Paint()..color = const Color(0xfff2e8cf), + children: [RectangleHitbox()], + ); + + @override + FutureOr onLoad() async { + super.onLoad(); + size = Vector2(game.width, game.height); + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/components/raquette.dart b/client_flutter/lib/screens/my_games/touch_play/components/raquette.dart new file mode 100644 index 0000000..a2c5594 --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/components/raquette.dart @@ -0,0 +1,55 @@ +import 'package:flame/collisions.dart'; +import 'package:flame/components.dart'; +import 'package:flame/effects.dart'; +import 'package:flame/events.dart'; +import 'package:flutter/material.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/touch_play.dart'; + +class Raquette extends PositionComponent + with DragCallbacks, HasGameReference { + Raquette({ + required this.cornerRadius, + required super.position, + required super.size, + }) : super( + anchor: Anchor.center, + children: [RectangleHitbox()], + ); + + final Radius cornerRadius; + + final _paint = Paint() + ..color = Colors.purple + ..style = PaintingStyle.fill; + + @override + void render(Canvas canvas) { + super.render(canvas); + canvas.drawRRect( + RRect.fromRectAndRadius( + Offset.zero & size.toSize(), + cornerRadius, + ), + _paint, + ); + } + + @override + void onDragUpdate(DragUpdateEvent event) { + super.onDragUpdate(event); + position.x = (position.x + event.localDelta.x) + .clamp(width / 2, game.width - width / 2); + } + + void moveBy(double dx) { + add( + MoveToEffect( + Vector2( + (position.x + dx).clamp(width / 2, game.width - width / 2), + position.y, + ), + EffectController(duration: 0.1), + ), + ); + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/config.dart b/client_flutter/lib/screens/my_games/touch_play/config.dart new file mode 100644 index 0000000..296b1ca --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/config.dart @@ -0,0 +1,6 @@ +const gameWidth = 200.0; +const gameHeight = 200.0; +const fingerRadius = gameWidth * 0.04; +const batWidth = gameWidth * 0.5; // Add from here... +const batHeight = fingerRadius * 0.4; +const batStep = gameWidth * 0.05; diff --git a/client_flutter/lib/screens/my_games/touch_play/touch_play.dart b/client_flutter/lib/screens/my_games/touch_play/touch_play.dart new file mode 100644 index 0000000..eb52c5e --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/touch_play.dart @@ -0,0 +1,100 @@ +import 'dart:async'; +import 'dart:math' as math; + +import 'package:flame/components.dart'; +import 'package:flame/events.dart'; +import 'package:flame/game.dart'; +import 'package:flutter/material.dart'; + +import 'components/components.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/config.dart'; + +enum PlayState { welcome, playing, gameOver } + +class TouchPlay extends FlameGame with HasCollisionDetection, TapDetector { + TouchPlay() + : super( + camera: CameraComponent.withFixedResolution( + width: gameWidth, + height: gameHeight, + ), + ); + + final rand = math.Random(); + double get width => size.x; + double get height => size.y; + + late PlayState _playState; + final ValueNotifier score = ValueNotifier(0); + final ValueNotifier bestScore = ValueNotifier(0); + + PlayState get playState => _playState; + + set playState(PlayState playState) { + _playState = playState; + switch (playState) { + case PlayState.welcome: + case PlayState.gameOver: + overlays.add(playState.name); + world.removeAll(world.children.query()); + if (bestScore.value < score.value) { + bestScore.value = score.value; + } + score.value = 0; + case PlayState.playing: + overlays.remove(PlayState.gameOver.name); + overlays.remove(PlayState.welcome.name); + } + } + + @override + FutureOr onLoad() async { + super.onLoad(); + + camera.viewfinder.anchor = Anchor.topLeft; + + world.add(PlayArea()); + playState = PlayState.welcome; + score.value = 0; + bestScore.value = 0; + debugMode = true; + } + + void startGame() { + if (playState == PlayState.playing) return; + + world.removeAll(world.children.query()); + world.removeAll(world.children.query()); + + playState = PlayState.playing; + world.add( + Finger( + paintFinger: Paint() + ..color = const Color(0xff1e6091) + ..style = PaintingStyle.fill, + radius: fingerRadius, + position: size / 2, + velocity: Vector2((rand.nextDouble() - 0.5) * width, height * 0.2) + .normalized() + ..scale(height / 4), + ), + ); + world.add( + Raquette( + // Add from here... + size: Vector2(batWidth, batHeight), + cornerRadius: const Radius.circular(fingerRadius / 2), + position: Vector2(width / 2, height * 0.95), + ), + ); + } + + @override + void onTap() { + super.onTap(); + startGame(); + } + + @override + Color backgroundColor() => const Color(0xfff2e8cf); +} diff --git a/client_flutter/lib/screens/my_games/touch_play/view/overlay_screen.dart b/client_flutter/lib/screens/my_games/touch_play/view/overlay_screen.dart new file mode 100644 index 0000000..9bfcc6b --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/view/overlay_screen.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_animate/flutter_animate.dart'; + +class OverlayScreen extends StatelessWidget { + const OverlayScreen({ + super.key, + required this.title, + required this.subtitle, + }); + + final String title; + final String subtitle; + + @override + Widget build(BuildContext context) { + return Container( + alignment: const Alignment(0, -0.15), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: Theme.of(context).textTheme.headlineMedium, + ).animate().slideY(duration: 750.ms, begin: -3, end: 0), + const SizedBox(height: 30), + Text( + subtitle, + style: Theme.of(context).textTheme.headlineSmall, + ) + .animate(onPlay: (controller) => controller.repeat()) + .fadeIn(duration: 1.seconds) + .then() + .fadeOut(duration: 1.seconds), + ], + ), + ); + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/view/score_card.dart b/client_flutter/lib/screens/my_games/touch_play/view/score_card.dart new file mode 100644 index 0000000..2a53cc3 --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/view/score_card.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; + +class ScoreCard extends StatelessWidget { + const ScoreCard({ + super.key, + required this.score, + required this.bestScore, + }); + + final ValueNotifier score; + final ValueNotifier bestScore; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.fromLTRB(12, 6, 12, 18), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ValueListenableBuilder( + valueListenable: bestScore, + builder: (context, bestScore, child) { + return Text( + 'Best Score: $bestScore'.toUpperCase(), + style: Theme.of(context).textTheme.titleLarge!, + ); + }, + ), + const SizedBox( + height: 10, + ), + ValueListenableBuilder( + valueListenable: score, + builder: (context, score, child) { + return Text( + 'Score: $score'.toUpperCase(), + style: Theme.of(context).textTheme.titleLarge!, + ); + }, + ), + ], + ), + ); + } +} diff --git a/client_flutter/lib/screens/my_games/touch_play/view/touch_play_screen.dart b/client_flutter/lib/screens/my_games/touch_play/view/touch_play_screen.dart new file mode 100644 index 0000000..afead8b --- /dev/null +++ b/client_flutter/lib/screens/my_games/touch_play/view/touch_play_screen.dart @@ -0,0 +1,88 @@ +import 'package:flame/game.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/touch_play.dart'; +import 'package:kar_assistant/screens/my_games/touch_play/config.dart'; +import 'overlay_screen.dart'; +import 'score_card.dart'; + +class TouchPlayScreen extends StatefulWidget { + const TouchPlayScreen({super.key}); + + @override + State createState() => _MyGameScreenState(); +} + +class _MyGameScreenState extends State { + late final TouchPlay game; + + @override + void initState() { + super.initState(); + game = TouchPlay(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Theme( + data: ThemeData( + textTheme: GoogleFonts.pressStart2pTextTheme().apply( + bodyColor: const Color(0xff184e77), + displayColor: const Color(0xff184e77), + ), + ), + child: Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xffa9d6e5), + Color(0xfff2e8cf), + ], + ), + ), + child: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16), + child: Center( + child: Column( + children: [ + ScoreCard( + score: game.score, + bestScore: game.bestScore, + ), + Expanded( + child: FittedBox( + child: SizedBox( + width: gameWidth, + height: gameHeight, + child: GameWidget( + game: game, + overlayBuilderMap: { + PlayState.welcome.name: (context, game) => + const OverlayScreen( + title: 'PLAY', + subtitle: 'Touch to start', + ), + PlayState.gameOver.name: (context, game) => + const OverlayScreen( + title: 'GAME OVER', + subtitle: 'Touch to continue', + ), + }, + ), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/client_flutter/lib/screens/options_page/view/options_page.dart b/client_flutter/lib/screens/options_page/view/options_page.dart new file mode 100644 index 0000000..95b6d18 --- /dev/null +++ b/client_flutter/lib/screens/options_page/view/options_page.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'package:kar_assistant/core/widgets/work_in_progress.dart'; +import 'package:kar_assistant/main.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; + +class OptionsPage extends StatelessWidget { + const OptionsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text( + "Options", + style: TextStyle(color: Colors.white), + ), + backgroundColor: Theme.of(context).colorScheme.primary, + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const Expanded(child: WorkInProgress()), + Expanded( + child: Column( + children: [ + ElevatedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.pressed)) { + return Colors.red; + } else { + return Colors.transparent; + } + }, + ), + ), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text( + 'Attention', + ), + content: const Text( + 'Vous allez suprimmer votre compte et en créé un nouveau, ĂȘtes vous sur ?', + style: TextStyle(color: Colors.red), + ), + actions: [ + ElevatedButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('Annuler'), + ), + ElevatedButton( + onPressed: () async { + UtilsController().removeToken().then((value) { + Navigator.of(context) + .popUntil((route) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const MyApp(), + ), + ); + // final SnackBar snackBar = SnackBar( + // content: const Row( + // children: [ + // Icon(MdiIcons.check), + // Text( + // 'Compte supprimer', + // style: TextStyle(color: Colors.green), + // ), + // ], + // ), + // duration: const Duration(seconds: 4), + // backgroundColor: Colors.transparent, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(5), + // ), + // behavior: SnackBarBehavior.floating, + // width: 200, + // ); + // snackBarKey.currentState + // ?.showSnackBar(SnackBar( + // content: Text('test'), + // duration: Duration(seconds: 4), + // )); + }); + }, + child: const Text('Confirmez'), + ), + ], + ); + }, + ); + }, + child: const Text('Supprimer le compte'), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/client_flutter/lib/services/http_repo.dart b/client_flutter/lib/services/http_repo.dart new file mode 100644 index 0000000..776c6c1 --- /dev/null +++ b/client_flutter/lib/services/http_repo.dart @@ -0,0 +1,184 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:kar_assistant/core/globals.dart' as globals; +import 'package:http/http.dart' as http; +import 'package:kar_assistant/services/http_repository.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; + +class HttpRepo implements HttpRepository { + int timeOutSeconds = 20; + String responseTimeOut = jsonEncode({ + 'type': 'error', + 'status': 408, + 'message': 'Le serveur a mis trop de temps Ă  rĂ©pondre', + }); + String responseOtherError = jsonEncode({ + 'type': 'error', + 'status': 404, + 'message': 'Le serveur semble ne pas ĂȘtre accessible', + }); + Map? header; + String baseUrl = globals.envBaseUrl!; + HttpRepo() { + if (globals.clientToken != null) { + header = { + 'karaeatcookies': globals.clientToken!, + 'Content-Type': 'application/json; charset=UTF-8', + 'Accept': 'application/json', + }; + } else { + header = { + 'Accept': 'application/json', + }; + } + } + + Uri getUri(String url, {Map? parameters}) { + String base = baseUrl.replaceAll("http://", ""); + base = base.replaceAll("https://", ""); + List listUrl = []; + listUrl = base.split("/"); + base = listUrl[0]; + listUrl.removeAt(0); + String chemin = ""; + if (listUrl.isEmpty) { + chemin = url; + } else { + chemin = "${listUrl.join("/")}/$url"; + } + if (baseUrl.contains("http://")) { + return Uri.http(base, chemin, parameters); + } else { + return Uri.https(base, chemin, parameters); + } + } + + @override + Future getRequest(String url) async { + http.Response response; + try { + final client = + globals.clientTest != null ? globals.clientTest! : http.Client(); + response = await client + .get(getUri(url), headers: header) + .timeout( + Duration(seconds: timeOutSeconds), + onTimeout: () => http.Response(responseTimeOut, 408), + ) + .onError( + (error, stackTrace) => http.Response(responseOtherError, 503), + ); + + if (response.statusCode < 200 || response.statusCode > 299) { + final error = json.decode(response.body); + throw error['message']; + } + return response; + } catch (e) { + rethrow; + } + } + + @override + Future getRequestParams( + String url, + Map parameters, + ) async { + http.Response response; + try { + final client = + globals.clientTest != null ? globals.clientTest! : http.Client(); + response = await client + .get(getUri(url, parameters: parameters), headers: header) + .timeout( + Duration(seconds: timeOutSeconds), + onTimeout: () => http.Response(responseTimeOut, 408), + ) + .onError( + (error, stackTrace) => http.Response(responseOtherError, 503), + ); + if (response.statusCode < 200 || response.statusCode > 299) { + final error = json.decode(response.body); + throw error['message']; + } + return response; + } catch (e) { + rethrow; + } + } + + @override + Future> getRequestParamsSecure( + String url, + Map data, { + bool secondTry = false, + }) async { + http.Response response; + try { + Map parameters = + await UtilsController().encryptApi(data); + response = await http + .get(getUri(url, parameters: parameters), headers: header) + .timeout( + Duration(seconds: timeOutSeconds), + onTimeout: () => http.Response(responseTimeOut, 408), + ) + .onError( + (error, stackTrace) => http.Response(responseOtherError, 503), + ); + print(response.statusCode); + print(response.body); + if (response.statusCode < 200 || response.statusCode > 299) { + if (response.statusCode == 404 && secondTry != true) { + String newtoken = await UtilsController().setupToken(); + globals.clientToken = newtoken; + return await HttpRepo() + .getRequestParamsSecure(url, data, secondTry: true); + } + throw response.body; + } + + var parsedResponse = jsonDecode(response.body); + + Map value = + await UtilsController().decryptApi(parsedResponse); + return value; + } catch (e) { + rethrow; + } + } + + @override + Future postRequest( + String url, + Map data, + ) async { + http.Response response; + + try { + final client = + globals.clientTest != null ? globals.clientTest! : http.Client(); + response = await client + .post( + getUri(url), + headers: header, + body: Uri.encodeFull(jsonEncode(data)), + ) + .timeout( + Duration(seconds: timeOutSeconds), + onTimeout: () => http.Response(responseTimeOut, 408), + ) + .onError( + (error, stackTrace) => http.Response(responseOtherError, 503), + ); + + if (response.statusCode < 200 || response.statusCode > 299) { + final error = json.decode(response.body); + throw error['message']; + } + return response; + } catch (e) { + rethrow; + } + } +} diff --git a/app_flutter/lib/services/http_repository.dart b/client_flutter/lib/services/http_repository.dart similarity index 74% rename from app_flutter/lib/services/http_repository.dart rename to client_flutter/lib/services/http_repository.dart index 09a3e69..3a8b52c 100644 --- a/app_flutter/lib/services/http_repository.dart +++ b/client_flutter/lib/services/http_repository.dart @@ -1,4 +1,5 @@ import 'package:http/http.dart' as http; + abstract class HttpRepository { Future getRequest(String url); @@ -6,6 +7,10 @@ abstract class HttpRepository { Future getRequestParams(String url, Map data); - Future postRequest(String url, Map data); + Future> getRequestParamsSecure( + String url, + Map data, + ); -} \ No newline at end of file + Future postRequest(String url, Map data); +} diff --git a/client_flutter/lib/services/utils_controller.dart b/client_flutter/lib/services/utils_controller.dart new file mode 100644 index 0000000..a336662 --- /dev/null +++ b/client_flutter/lib/services/utils_controller.dart @@ -0,0 +1,151 @@ +import 'dart:convert'; + +import 'package:encrypt/encrypt.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:kar_assistant/core/globals.dart' as globals; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:kar_assistant/core/repository/client_repo.dart'; +import 'package:convert/convert.dart'; +import 'package:pointycastle/export.dart'; + +class UtilsController { + AndroidOptions secureOptions() => const AndroidOptions( + encryptedSharedPreferences: true, + ); + + final FlutterSecureStorage storage = const FlutterSecureStorage(); + Future init() async { + await Future.wait([initEnv()]); + } + + Future initEnv() async { + await dotenv.load(fileName: ".env"); + globals.envBaseUrl = dotenv.env['BASEURL'].toString(); + globals.envMode = dotenv.env['MODE'].toString(); + } + + Future readStorage(String key) async { + String value; + value = await storage.read(key: key) ?? ''; + return value; + } + + Future setStorage(String key, String value) async { + await storage.write(key: key, value: value); + } + + Future deleteStorage(String key) async { + await storage.delete(key: key); + } + + Future verifTokenExistStorage() async { + String clientToken = await readStorage('clientToken'); + if (clientToken == '') { + clientToken = await setupToken(); + } + globals.clientToken = clientToken; + } + + Future setupToken() async { + Map data = { + "appType": 'mobile_app', + }; + var result = await ClientRepo().newToken(data); + await setStorage('clientPrivateKey', result['clientPrivateKey']); + await setStorage('clientToken', result['clientToken']); + await setStorage('backPublicKey', result['backPublicKey']); + String clientToken = result['clientToken']; + return clientToken; + } + + Future removeToken() async { + await deleteStorage('clientPrivateKey'); + await deleteStorage('clientToken'); + await deleteStorage('backPublicKey'); + } + + Future encryptRSA(String keyToEncrypt) async { + final stringPublicKey = + await UtilsController().readStorage('backPublicKey'); + RSAPublicKey publicKey = + RSAKeyParser().parse(stringPublicKey) as RSAPublicKey; + final encrypterRsa = Encrypter( + RSA( + publicKey: publicKey, + encoding: RSAEncoding.OAEP, + ), + ); + Encrypted encrypted = encrypterRsa.encrypt( + keyToEncrypt, + ); + return encrypted; + } + + Future decryptRSA(Encrypted keyToDecrypt) async { + final stringPrivateKey = + await UtilsController().readStorage('clientPrivateKey'); + RSAPrivateKey privateKey = + RSAKeyParser().parse(stringPrivateKey) as RSAPrivateKey; + final decrypter = Encrypter( + RSA( + privateKey: privateKey, + encoding: RSAEncoding.OAEP, + ), + ); + String decrypted = decrypter.decrypt(keyToDecrypt); + return decrypted; + } + + Encrypted encryptAES(String plainText, Key key, IV iv) { + final encrypter = Encrypter(AES(key, mode: AESMode.cbc)); + Encrypted encrypted = encrypter.encrypt(plainText, iv: iv); + return encrypted; + } + + String decryptAES(Encrypted encrypted, Key key, IV iv) { + final encrypter = Encrypter(AES(key, mode: AESMode.cbc)); + String decrypted = encrypter.decrypt(encrypted, iv: iv); + return decrypted; + } + + Future> encryptApi(jsonData) async { + //encrypted + jsonData['date'] = DateTime.now().toUtc().toIso8601String(); + + String dataString = jsonEncode(jsonData); + final key = Key.fromSecureRandom(16); + final iv = IV.fromSecureRandom(16); + Encrypted dataEncrypted = UtilsController().encryptAES(dataString, key, iv); + String dataAes = '{"key":"${key.base64}","iv":"${iv.base64}"}'; + Encrypted dataAesEncrypted = await UtilsController().encryptRSA(dataAes); + Map data = { + 'data': hex.encode(dataEncrypted.bytes), + 'aes': dataAesEncrypted.base64, + }; + return data; + } + + Future> decryptApi(parsedResponse) async { + String dataAesDecrypted = await UtilsController() + .decryptRSA(Encrypted.fromBase64(parsedResponse['aes'])); + var jsonDataAes = jsonDecode(dataAesDecrypted); + String message = UtilsController().decryptAES( + Encrypted(hex.decode(parsedResponse['data']) as Uint8List), + Key.fromBase64(jsonDataAes['key']), + IV.fromBase64(jsonDataAes['iv']), + ); + + Map value = jsonDecode(message); + // La valeur stockĂ©e dans un JSON + + message = message.replaceAllMapped( + RegExp(r'\\+x([0-9a-fA-F]{2})'), + (match) => String.fromCharCode(int.parse(match.group(1)!, radix: 16)), + ); + // DĂ©coder le JSON + value = json.decode(message); + + return value; + } +} diff --git a/app_flutter/pubspec.lock b/client_flutter/pubspec.lock similarity index 61% rename from app_flutter/pubspec.lock rename to client_flutter/pubspec.lock index 1ffc3f3..1c6927a 100644 --- a/app_flutter/pubspec.lock +++ b/client_flutter/pubspec.lock @@ -5,18 +5,34 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "58826e40314219b223f4723dd4205845040161cdc2df3e6a1cdceed5d8165084" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "63.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: f85566ec7b3d25cbea60f7dd4f157c5025f2f19233ca4feeed33b616c78a26a3 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "5.13.0" + animations: + dependency: "direct main" + description: + name: animations + sha256: ef57563eed3620bd5d75ad96189846aca1e033c0c45fc9a7d26e80ab02b88a70 + url: "https://pub.dev" + source: hosted + version: "2.0.8" + archive: + dependency: transitive + description: + name: archive + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.dev" + source: hosted + version: "3.4.10" args: dependency: transitive description: @@ -25,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.2" + asn1lib: + dependency: transitive + description: + name: asn1lib + sha256: "21afe4333076c02877d14f4a89df111e658a6d466cbfc802eb705eb91bd5adfd" + url: "https://pub.dev" + source: hosted + version: "1.5.0" async: dependency: "direct main" description: @@ -61,34 +85,34 @@ packages: dependency: transitive description: name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "6c4dd11d05d056e76320b828a1db0fc01ccd376922526f8e9d6c796a5adbac20" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.8" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "7.2.11" built_collection: dependency: transitive description: @@ -101,10 +125,10 @@ packages: dependency: transitive description: name: built_value - sha256: "598a2a682e2a7a90f08ba39c0aaa9374c5112340f0a2e275f61b59389543d166" + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 url: "https://pub.dev" source: hosted - version: "8.6.1" + version: "8.8.1" characters: dependency: transitive description: @@ -121,6 +145,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + url: "https://pub.dev" + source: hosted + version: "0.4.1" clock: dependency: transitive description: @@ -133,18 +165,18 @@ packages: dependency: transitive description: name: code_builder - sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.dev" source: hosted - version: "4.5.0" + version: "4.10.0" collection: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.2" convert: dependency: transitive description: @@ -153,6 +185,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + url: "https://pub.dev" + source: hosted + version: "1.6.4" crypto: dependency: transitive description: @@ -165,10 +205,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" dart_style: dependency: transitive description: @@ -177,6 +217,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + encrypt: + dependency: "direct main" + description: + name: encrypt + sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + url: "https://pub.dev" + source: hosted + version: "5.0.3" fake_async: dependency: transitive description: @@ -189,10 +237,10 @@ packages: dependency: transitive description: name: ffi - sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.0" file: dependency: transitive description: @@ -209,11 +257,27 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + flame: + dependency: "direct main" + description: + name: flame + sha256: "2a2352741500ce47823dcf212f06b23e9bdb622454eab90244ee6da58e23b488" + url: "https://pub.dev" + source: hosted + version: "1.15.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_animate: + dependency: "direct main" + description: + name: flutter_animate + sha256: "7c8a6594a9252dad30cc2ef16e33270b6248c4dedc3b3d06c86c4f3f4dc05ae5" + url: "https://pub.dev" + source: hosted + version: "4.5.0" flutter_dotenv: dependency: "direct main" description: @@ -222,19 +286,91 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" + url: "https://pub.dev" + source: hosted + version: "0.13.1" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" flutter_localizations: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685 + url: "https://pub.dev" + source: hosted + version: "9.0.0" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c + url: "https://pub.dev" + source: hosted + version: "3.0.1" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: "5809c66f9dd3b4b93b0a6e2e8561539405322ee767ac2f64d084e2ab5429d108" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + flutter_shaders: + dependency: transitive + description: + name: flutter_shaders + sha256: "02750b545c01ff4d8e9bbe8f27a7731aa3778402506c67daa1de7f5fc3f4befe" + url: "https://pub.dev" + source: hosted + version: "0.1.2" + flutter_spinkit: + dependency: "direct main" + description: + name: flutter_spinkit + sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e + url: "https://pub.dev" + source: hosted + version: "5.2.0" flutter_test: dependency: "direct dev" description: flutter @@ -244,10 +380,10 @@ packages: dependency: "direct main" description: name: flutter_tts - sha256: b5e3e12c91cff97f912111937f190006f70c685e9fac78a4ff5c2220b860a6a9 + sha256: cbb3fd43b946e62398560235469e6113e4fe26c40eab1b7cb5e7c417503fb3a8 url: "https://pub.dev" source: hosted - version: "3.8.1" + version: "3.8.5" flutter_web_plugins: dependency: transitive description: flutter @@ -269,6 +405,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: f0b8d115a13ecf827013ec9fc883390ccc0e87a96ed5347a3114cac177ef18e8 + url: "https://pub.dev" + source: hosted + version: "6.1.0" graphs: dependency: transitive description: @@ -281,10 +425,10 @@ packages: dependency: "direct main" description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -301,14 +445,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image: + dependency: transitive + description: + name: image + sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d" + url: "https://pub.dev" + source: hosted + version: "4.1.4" intl: dependency: "direct main" description: name: intl - sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.18.0" + version: "0.18.1" io: dependency: transitive description: @@ -361,18 +513,18 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" material_design_icons_flutter: dependency: "direct main" description: @@ -397,6 +549,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" nested: dependency: transitive description: @@ -405,6 +565,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + ordered_set: + dependency: transitive + description: + name: ordered_set + sha256: "3858c7d84619edfab87c3e367584648020903187edb70b52697646f4b2a93022" + url: "https://pub.dev" + source: hosted + version: "5.0.2" package_config: dependency: transitive description: @@ -425,50 +601,50 @@ packages: dependency: "direct main" description: name: path_provider - sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8" + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5" + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.2" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3 + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84 + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" pedantic: dependency: transitive description: @@ -481,18 +657,18 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81" + sha256: bc56bfe9d3f44c3c612d8d393bd9b174eb796d706759f9b495ac254e4294baa5 url: "https://pub.dev" source: hosted - version: "10.4.3" + version: "10.4.5" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: "2ffaf52a21f64ac9b35fe7369bb9533edbd4f698e5604db8645b1064ff4cf221" + sha256: "59c6322171c29df93a22d150ad95f3aa19ed86542eaec409ab2691b8f35f9a47" url: "https://pub.dev" source: hosted - version: "10.3.3" + version: "10.3.6" permission_handler_apple: dependency: transitive description: @@ -505,10 +681,10 @@ packages: dependency: transitive description: name: permission_handler_platform_interface - sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9" + sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" url: "https://pub.dev" source: hosted - version: "3.11.3" + version: "3.12.0" permission_handler_windows: dependency: transitive description: @@ -517,22 +693,38 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.3" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "3.7.3" pool: dependency: transitive description: @@ -545,10 +737,10 @@ packages: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.1" pub_semver: dependency: transitive description: @@ -573,6 +765,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" shelf_web_socket: dependency: transitive description: @@ -590,10 +798,10 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.5.0" source_helper: dependency: transitive description: @@ -602,22 +810,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" source_span: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" speech_to_text: dependency: "direct main" description: name: speech_to_text - sha256: "59393a58815a517dc1237a81ccbaf8302f44d107d84fafca9c295cdf7fff404f" + sha256: e2c2667088a9800ffb504dbb34997314e3cae2f92ad5ed76c49124fb1bc6edac url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.5.1" speech_to_text_macos: dependency: transitive description: @@ -674,14 +898,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" + url: "https://pub.dev" + source: hosted + version: "1.24.3" test_api: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.0" + test_core: + dependency: transitive + description: + name: test_core + sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" + url: "https://pub.dev" + source: hosted + version: "0.5.3" timing: dependency: transitive description: @@ -706,6 +946,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + url: "https://pub.dev" + source: hosted + version: "11.10.0" watcher: dependency: transitive description: @@ -714,6 +962,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" web_socket_channel: dependency: transitive description: @@ -722,22 +978,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" win32: dependency: transitive description: name: win32 - sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0 + sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 url: "https://pub.dev" source: hosted - version: "5.0.6" + version: "5.1.1" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + url: "https://pub.dev" + source: hosted + version: "6.3.0" yaml: dependency: transitive description: @@ -747,5 +1019,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.6 <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.1.0 <4.0.0" + flutter: ">=3.13.0" diff --git a/app_flutter/pubspec.yaml b/client_flutter/pubspec.yaml similarity index 80% rename from app_flutter/pubspec.yaml rename to client_flutter/pubspec.yaml index e682b63..e164df8 100644 --- a/app_flutter/pubspec.yaml +++ b/client_flutter/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: sdk: flutter material_design_icons_flutter: ^5.0.6595 permission_handler: ^10.0.0 - http: ^0.13.4 + http: ^1.1.0 flutter_dotenv: ^5.0.2 path_provider: ^2.0.9 provider: ^6.0.1 @@ -25,19 +25,36 @@ dependencies: json_serializable: ^6.1.1 intl: ^0.18.0 async: ^2.8.2 + google_fonts: ^6.1.0 + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 speech_to_text: ^6.3.0 - flutter_tts: ^3.8.1 + flutter_tts: ^3.8.5 + animations: ^2.0.8 + flutter_spinkit: ^5.2.0 + flutter_secure_storage: ^9.0.0 + encrypt: ^5.0.3 + flutter_launcher_icons: ^0.13.1 + flame: ^1.11.0 + flutter_animate: ^4.2.0 + dev_dependencies: build_runner: ^2.1.6 flutter_test: sdk: flutter flutter_lints: ^2.0.0 + test: ^1.24.3 + mockito: ^5.4.2 +flutter_launcher_icons: + android: "launcher_icon" + ios: true + image_path: "image/kara_PP_circle.png" + min_sdk_android: 21 # The following section is specific to Flutter packages. flutter: @@ -49,6 +66,8 @@ flutter: # To add assets to your application, add an assets section, like this: assets: + - image/ + - assets/images/ - .env # An image asset can refer to one or more resolution-specific "variants", see diff --git a/client_flutter/test/kara_controller_test.dart b/client_flutter/test/kara_controller_test.dart new file mode 100644 index 0000000..521a427 --- /dev/null +++ b/client_flutter/test/kara_controller_test.dart @@ -0,0 +1,43 @@ +import 'package:kar_assistant/core/models/kara_response.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; +import 'package:test/test.dart'; +import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart'; +import 'package:mockito/annotations.dart'; + +@GenerateNiceMocks([MockSpec(), MockSpec()]) +void main() { + UtilsController().initEnv(); + group('verifIsToken', () { + test('value should start at null', () { + expect(KaraController().karaLastResponse, isNull); + }); + + // test('value should be loaded', () async { + // MockKaraController controller = MockKaraController(); + + // KaraResponse response= KaraResponse.fromJson(json.decode("""{ + // "similarity": 0.212, + // "bestPhrase": "Bonjour", + // "shortAnswerExpected": false, + // "clientExist": false, + // "lang": "fr", + // "skill": "kara/greetings", + // "result": "Bonjour je suis Kara", + // "convToken": "Token" + // }""")); + + // when(controller.askedKara('bonjour')).thenAnswer((_) async => response); + + // expect(await controller.askedKara('bonjour'), response); + + // expect(controller.karaLastResponse, isNotNull); + // expect(controller.karaLastResponse, isA); + // }); + + test('token Should be in value', () { + KaraController controller = KaraController(); + // controller.mockAskedKara(); + expect(controller.verifIsToken(), isTrue); + }); + }); +} diff --git a/client_flutter/test/kara_controller_test.mocks.dart b/client_flutter/test/kara_controller_test.mocks.dart new file mode 100644 index 0000000..6bd7b08 --- /dev/null +++ b/client_flutter/test/kara_controller_test.mocks.dart @@ -0,0 +1,221 @@ +// Mocks generated by Mockito 5.4.2 from annotations +// in kar_assistant/test/kara_controller_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i6; + +import 'package:kar_assistant/core/models/conversation/message_conversation.dart' + as _i5; +import 'package:kar_assistant/core/models/kara_response.dart' as _i3; +import 'package:kar_assistant/core/repository/kara_repo.dart' as _i2; +import 'package:kar_assistant/screens/home_page/controller/kara_controller.dart' + as _i4; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeKaraRepo_0 extends _i1.SmartFake implements _i2.KaraRepo { + _FakeKaraRepo_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeKaraResponse_1 extends _i1.SmartFake implements _i3.KaraResponse { + _FakeKaraResponse_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [KaraController]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockKaraController extends _i1.Mock implements _i4.KaraController { + @override + _i2.KaraRepo get karaRepo => (super.noSuchMethod( + Invocation.getter(#karaRepo), + returnValue: _FakeKaraRepo_0( + this, + Invocation.getter(#karaRepo), + ), + returnValueForMissingStub: _FakeKaraRepo_0( + this, + Invocation.getter(#karaRepo), + ), + ) as _i2.KaraRepo); + @override + set karaLastResponse(_i3.KaraResponse? _karaLastResponse) => + super.noSuchMethod( + Invocation.setter( + #karaLastResponse, + _karaLastResponse, + ), + returnValueForMissingStub: null, + ); + @override + String get lastWords => (super.noSuchMethod( + Invocation.getter(#lastWords), + returnValue: '', + returnValueForMissingStub: '', + ) as String); + @override + set lastWords(String? _lastWords) => super.noSuchMethod( + Invocation.setter( + #lastWords, + _lastWords, + ), + returnValueForMissingStub: null, + ); + @override + List<_i5.MessageConversation> get listResponse => (super.noSuchMethod( + Invocation.getter(#listResponse), + returnValue: <_i5.MessageConversation>[], + returnValueForMissingStub: <_i5.MessageConversation>[], + ) as List<_i5.MessageConversation>); + @override + set listResponse(List<_i5.MessageConversation>? _listResponse) => + super.noSuchMethod( + Invocation.setter( + #listResponse, + _listResponse, + ), + returnValueForMissingStub: null, + ); + @override + _i6.Future<_i3.KaraResponse> askedKara(String? text) => (super.noSuchMethod( + Invocation.method( + #askedKara, + [text], + ), + returnValue: _i6.Future<_i3.KaraResponse>.value(_FakeKaraResponse_1( + this, + Invocation.method( + #askedKara, + [text], + ), + )), + returnValueForMissingStub: + _i6.Future<_i3.KaraResponse>.value(_FakeKaraResponse_1( + this, + Invocation.method( + #askedKara, + [text], + ), + )), + ) as _i6.Future<_i3.KaraResponse>); + @override + bool verifIsToken() => (super.noSuchMethod( + Invocation.method( + #verifIsToken, + [], + ), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); +} + +/// A class which mocks [KaraResponse]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockKaraResponse extends _i1.Mock implements _i3.KaraResponse { + @override + String get result => (super.noSuchMethod( + Invocation.getter(#result), + returnValue: '', + returnValueForMissingStub: '', + ) as String); + @override + set result(String? _result) => super.noSuchMethod( + Invocation.setter( + #result, + _result, + ), + returnValueForMissingStub: null, + ); + @override + set language(String? _language) => super.noSuchMethod( + Invocation.setter( + #language, + _language, + ), + returnValueForMissingStub: null, + ); + @override + set skill(String? _skill) => super.noSuchMethod( + Invocation.setter( + #skill, + _skill, + ), + returnValueForMissingStub: null, + ); + @override + double get similarity => (super.noSuchMethod( + Invocation.getter(#similarity), + returnValue: 0.0, + returnValueForMissingStub: 0.0, + ) as double); + @override + set similarity(double? _similarity) => super.noSuchMethod( + Invocation.setter( + #similarity, + _similarity, + ), + returnValueForMissingStub: null, + ); + @override + String get bestPhrase => (super.noSuchMethod( + Invocation.getter(#bestPhrase), + returnValue: '', + returnValueForMissingStub: '', + ) as String); + @override + set bestPhrase(String? _bestPhrase) => super.noSuchMethod( + Invocation.setter( + #bestPhrase, + _bestPhrase, + ), + returnValueForMissingStub: null, + ); + @override + set convToken(String? _convToken) => super.noSuchMethod( + Invocation.setter( + #convToken, + _convToken, + ), + returnValueForMissingStub: null, + ); + @override + set userToken(String? _userToken) => super.noSuchMethod( + Invocation.setter( + #userToken, + _userToken, + ), + returnValueForMissingStub: null, + ); + @override + Map toJson() => (super.noSuchMethod( + Invocation.method( + #toJson, + [], + ), + returnValue: {}, + returnValueForMissingStub: {}, + ) as Map); +} diff --git a/client_flutter/test/kara_repo_test.dart b/client_flutter/test/kara_repo_test.dart new file mode 100644 index 0000000..c25fe89 --- /dev/null +++ b/client_flutter/test/kara_repo_test.dart @@ -0,0 +1,75 @@ +import 'package:http/http.dart' as http; +import 'package:flutter_test/flutter_test.dart'; +import 'package:kar_assistant/core/models/kara_response.dart'; +import 'package:kar_assistant/core/repository/kara_repo.dart'; +import 'package:kar_assistant/services/http_repo.dart'; +import 'package:kar_assistant/services/utils_controller.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:kar_assistant/core/globals.dart' as globals; + +import 'kara_repo_test.mocks.dart'; + +@GenerateMocks([http.Client]) +void main() { + late MockClient client; + late HttpRepo httpRepo; + late KaraRepo karaRepo; + setUpAll(() { + client = MockClient(); + globals.clientTest = client; + httpRepo = HttpRepo(); + karaRepo = KaraRepo(); + }); + UtilsController().initEnv(); + group('heyKara', () { + test('return a KaraResponse', () async { + // Use Mockito to return a successful response when it calls the + // provided http.Client. + Map data = { + 'query': 'Bonjour', + 'convToken': '', + 'clientToken': '', + 'timeZone': 'Europe/Paris', + }; + when(client.get(httpRepo.getUri("api/heyKara", parameters: data), + headers: httpRepo.header,),) + .thenAnswer( + (_) async => http.Response( + '''{ + "similarity": 0.212, + "bestPhrase": "Bonjour", + "shortAnswerExpected": false, + "clientExist": false, + "lang": "fr", + "skill": "kara/greetings", + "result": "Bonjour je suis Kara", + "convToken": "Token" + }''', + 200, + ), + ); + + expect(await karaRepo.heyKara(data, client), isA()); + }); + + test('throws an http exception', () { + // Use Mockito to return a successful response when it calls the + // provided http.Client. + Map data = { + 'query': 'Bonjour', + 'convToken': '', + 'clientToken': '', + 'timeZone': 'Europe/Paris', + }; + + // Use Mockito to return an unsuccessful response when it calls the + // provided http.Client. + when(client.get(httpRepo.getUri("api/heyKara", parameters: data), + headers: httpRepo.header,),) + .thenAnswer((_) async => http.Response('Not Found', 404)); + + expect(karaRepo.heyKara(data, client), throwsException); + }); + }); +} diff --git a/client_flutter/test/kara_repo_test.mocks.dart b/client_flutter/test/kara_repo_test.mocks.dart new file mode 100644 index 0000000..1d8a52d --- /dev/null +++ b/client_flutter/test/kara_repo_test.mocks.dart @@ -0,0 +1,263 @@ +// Mocks generated by Mockito 5.4.2 from annotations +// in kar_assistant/test/kara_repo_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; +import 'dart:convert' as _i4; +import 'dart:typed_data' as _i5; + +import 'package:http/http.dart' as _i2; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { + _FakeResponse_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeStreamedResponse_1 extends _i1.SmartFake + implements _i2.StreamedResponse { + _FakeStreamedResponse_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [Client]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockClient extends _i1.Mock implements _i2.Client { + MockClient() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.Future<_i2.Response> head( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future<_i2.Response> get( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future<_i2.Response> post( + Uri? url, { + Map? headers, + Object? body, + _i4.Encoding? encoding, + }) => + (super.noSuchMethod( + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future<_i2.Response> put( + Uri? url, { + Map? headers, + Object? body, + _i4.Encoding? encoding, + }) => + (super.noSuchMethod( + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future<_i2.Response> patch( + Uri? url, { + Map? headers, + Object? body, + _i4.Encoding? encoding, + }) => + (super.noSuchMethod( + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future<_i2.Response> delete( + Uri? url, { + Map? headers, + Object? body, + _i4.Encoding? encoding, + }) => + (super.noSuchMethod( + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, + ), + )), + ) as _i3.Future<_i2.Response>); + @override + _i3.Future read( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #read, + [url], + {#headers: headers}, + ), + returnValue: _i3.Future.value(''), + ) as _i3.Future); + @override + _i3.Future<_i5.Uint8List> readBytes( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #readBytes, + [url], + {#headers: headers}, + ), + returnValue: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), + ) as _i3.Future<_i5.Uint8List>); + @override + _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => + (super.noSuchMethod( + Invocation.method( + #send, + [request], + ), + returnValue: + _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( + this, + Invocation.method( + #send, + [request], + ), + )), + ) as _i3.Future<_i2.StreamedResponse>); + @override + void close() => super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValueForMissingStub: null, + ); +}