diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yml b/.github/ISSUE_TEMPLATE/1_bug_report.yml new file mode 100644 index 00000000..61243230 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.yml @@ -0,0 +1,120 @@ +name: Report a bug +description: | + You have discovered a bug in our widgets that is causing your application to crash + or throw an exception. It appears that a widget is buggy, or something is not functioning correctly. +body: + - type: markdown + attributes: + value: | + Thank you for using Syncfusion widgets! + + If you are looking for support, please check out our documentation, knowledge base, help bot, + and feedbacks. If you are unable to find a solution, please report the bug here. + + - [User Guide Documentation](https://help.syncfusion.com/flutter/introduction/overview) + - [Knowledge Base](https://support.syncfusion.com/kb/cross-platforms/category/79) + - [HelpBot](https://helpbot.syncfusion.com) + - [Feedbacks](https://stackoverflow.com/questions/tagged/flutter?sort=frequent) + + You can also contact us through the following methods. + - [Support portal](https://support.syncfusion.com) + - [Support forums](https://www.syncfusion.com/forums) + - [Feedback portal](https://www.syncfusion.com/feedback/flutter) + - type: textarea + attributes: + label: Bug description + description: Clearly and concisely describe the problem. + placeholder: | + A clear and concise description of what the bug is. + validations: + required: true + - type: textarea + attributes: + label: Steps to reproduce + description: Kindly provide us with detailed steps to replicate the issue you are experiencing. + placeholder: | + 1. ... + 2. ... + 3. ... + validations: + required: true + - type: textarea + attributes: + label: Code sample + description: | + Kindly create a simplified, reproducible example that demonstrates the issue + and include it within the code block delineated by backticks. + Note: Refrain from posting screenshots containing code. + value: | +
Code sample + + ```dart + [Add your code here] + ``` + +
+ validations: + required: true + - type: textarea + attributes: + label: Screenshots or Video + description: | + Upload any screenshots or video of the bug if applicable. + value: | +
+ Screenshots / Video demonstration + + [Upload media here] + +
+ validations: + required: true + - type: textarea + attributes: + label: Stack Traces + description: | + If it is a runtime exception, kindly provide the stack trace from the console. + If the traces are too large to be uploaded to GitHub, you may upload them as a `zip` file. + Note: If no stack trace is available, please mention it. + value: | +
Stack Traces + + ```dart + [Add the Stack Traces here] + ``` + +
+ validations: + required: true + - type: dropdown + id: target_platforms + attributes: + label: On which target platforms have you observed this bug? + multiple: true + options: + - Android + - iOS + - Web + - Web (Android browser) + - Web (iOS browser) + - Windows + - macOS + - Linux + validations: + required: true + - type: textarea + attributes: + label: Flutter Doctor output + description: | + Kindly share the complete details generated by executing the command + `flutter doctor -v` in your terminal. + value: | +
Doctor output + + ```console + [Add your output here] + ``` + +
+ validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.yml b/.github/ISSUE_TEMPLATE/2_feature_request.yml new file mode 100644 index 00000000..7f05a4ab --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.yml @@ -0,0 +1,41 @@ +name: Feature request +description: Propose a new idea. +body: + - type: markdown + attributes: + value: | + Thank you for using Syncfusion widgets! + + If you are looking for support, please check out our documentation, knowledge base, help bot, + and feedbacks. If you are unable to find a solution, please report the bug here. + + - [User Guide Documentation](https://help.syncfusion.com/flutter/introduction/overview) + - [Knowledge Base](https://support.syncfusion.com/kb/cross-platforms/category/79) + - [HelpBot](https://helpbot.syncfusion.com) + - [Feedbacks](https://stackoverflow.com/questions/tagged/flutter?sort=frequent) + + You can also contact us through the following methods. + - [Support portal](https://support.syncfusion.com) + - [Support forums](https://www.syncfusion.com/forums) + - [Feedback portal](https://www.syncfusion.com/feedback/flutter) + - type: textarea + attributes: + label: Use case + description: | + Kindly inform us of the issue you're encountering which has prompted you to suggest a new feature. + If your proposed feature is based on an existing problem, + could you please provide a detailed and concise explanation of the issue? + validations: + required: true + - type: textarea + attributes: + label: Proposal + description: | + Please provide a concise and precise description of your proposal. + + Include a visual representation of your concept. + * code samples + * images (illustrations, diagrams, screenshots) + * videos + validations: + required: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..45784b06 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.qodo diff --git a/LICENSE b/LICENSE index 3bad8521..7c89f3a2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,14 +1,14 @@ -Syncfusion License +Syncfusion® License -Syncfusion Flutter Charts package is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license. +Syncfusion Essential® Flutter library is available under the Syncfusion Essential Studio® program, and can be licensed either under the Syncfusion® Community License Program or the Syncfusion® commercial license. -To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions. +To be qualified for the Syncfusion® Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion® terms and conditions. Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options. -Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions. +Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion® license containing all terms and conditions. -The Syncfusion license that contains the terms and conditions can be found at +The Syncfusion® license that contains the terms and conditions can be found at https://www.syncfusion.com/content/downloads/syncfusion_license.pdf -Syncfusion provides implementation but you would subsequently need to have a license to use Flutter. The Flutter engine must be licensed from google directly. We do not license Flutter or the Flutter Engine and provide no license or rights even if you end up with the binaries from us by mistake. \ No newline at end of file +Syncfusion® provides implementation but you would subsequently need to have a license to use Flutter. The Flutter engine must be licensed from google directly. We do not license Flutter or the Flutter Engine and provide no license or rights even if you end up with the binaries from us by mistake. \ No newline at end of file diff --git a/README.md b/README.md index a32a9a34..a531e3e3 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,139 @@ -# Syncfusion Flutter Examples +# Syncfusion® Flutter examples -This repository contains the demos of Syncfusion Flutter UI widgets. This is the best place to check our widgets to get more insight about the usage of APIs. You can also check our widgets by installing the [sample browser application](https://play.google.com/store/apps/details?id=com.syncfusion.flutter.examples&hl=en) from Google Play Store, in which you can browse the demos for all the available widgets and view the source code of each example within the app itself. +This repository contains awesome demos of [Syncfusion® Flutter UI widgets](https://www.syncfusion.com/flutter-widgets). This is the best place to check our widgets to get more insight into the usage of APIs. You can also check our widgets by installing the complete Flutter sample browser from [Google Play Store](https://play.google.com/store/apps/details?id=com.syncfusion.flutter.examples) or [App Store](https://apps.apple.com/us/app/syncfusion-flutter-ui-widgets/id1475231341), in which you can browse the demo for all the widgets and view the source code of each sample within the app itself. -![showcase_image](https://cdn.syncfusion.com/content/images/FTControl/screen2.png) - -This section guides you how to use the Syncfusion Flutter examples in your applications. + ## Table of contents * [Requirements to run the demo](#requirements-to-run-the-demo) -* [Repository structure](#repository-structure) -* [Using the samples](#using-the-samples) -* [Support and feedback](#support-and-feedback) -* [Screenshots](#screenshots) -* [Disclaimer](#disclaimer) -* [About Syncfusion](#about-syncfusion) +* [Repository Structure](#repository-structure) +* [Widgets Catalog](#widgets-catalog) +* [License](#license) +* [Using the examples](#using-the-examples) +* [Support and Feedback](#support-and-feedback) ## Requirements to run the demo ## +* IDE tools are [Visual Studio code](https://flutter.dev/docs/get-started/editor?tab=vscode) and [Android studio](https://flutter.dev/docs/get-started/editor?tab=androidstudio). +* Flutter SDK + | Channel| Version| + |--------|--------| + | Stable | [3.24.0](https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.24.0-stable.zip)| -* [Flutter SDK](https://flutter.dev/docs/get-started/install/windows) -* [Android studio](https://developer.android.com/studio/install) or [Visual studio code](https://code.visualstudio.com/download) -* Install Flutter extension in Android studio or in [VS code](https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter) +* Dart and Flutter add-ons for Visual Studio Code (available via the Visual studio code extension) in Android Studio it available in plugin preference. -## Repository structure ## +## Repository Structure ## +The lib/samples directory contains the Flutter widget examples for each widget such as Charts, DataGrid, etc. All the examples can be deployed in Android, Web, Windows, iOS, Mac, and Linux platforms. -This repository contains sample browser project. Each widgets sample will be found inside the lib/samples folder. Run this project to see the demo samples of all the Flutter widgets in single application. +## Widgets Catalog ## -## Using the samples ## +| Widgets | Repository | +| ------------- | --------------- | +| Barcode Generator | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/barcodes) | +| Calendar | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/calendar) | +| Chat | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/chat) | +| Charts | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/chart) | +| DataGrid | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/datagrid) | +| Date Range Picker | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/date_picker) | +| Linear Gauge | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/linear_gauge) | +| Maps | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/maps) | +| PDF | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/pdf) | +| PDF Viewer | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/pdf_viewer) | +| Progress Bar | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/progress_bar) | +| Radial Gauge | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/gauge) | +| Range Selector | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/sliders/range_selector) | +| Range Slider | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/sliders/range_slider) | +| Slider | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/sliders/slider) | +| Spark Charts | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/sparkline) | +| Signature Pad | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/signature_pad) | +| Treemap | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/treemap) | +| XlsIO | [Link](https://github.com/syncfusion/flutter-examples/tree/master/lib/samples/xlsio) | -* Download or clone the files in repository. -* Get the required packages referred in the project. +## License ## -## Support and Feedback ## +Syncfusion® has no liability for any damage or consequence that may arise by the use or viewing of the examples. The examples are for demonstrative purposes and if you choose to use or access the examples you agree to not hold Syncfusion® liable, in any form, for any damage that is related to use, accessing or otherwise viewing the examples. By accessing, viewing, or otherwise seeing the examples you acknowledge and agree Syncfusion® examples will not allow you to seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize or otherwise do anything with Syncfusion® examples. -* For any other queries, reach our [Syncfusion support team](https://www.syncfusion.com/support/directtrac/incidents/newincident?utm_source=github&utm_medium=flutter_widgets) or post the queries through the [Community forums](https://www.syncfusion.com/forums?utm_source=github&utm_medium=flutter_widgets) and submit a feature request or a bug through our [Feedback portal](https://www.syncfusion.com/feedback/flutter). -* To renew the subscription, click [renew](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=flutter_widgets) or contact our sales team at . +## Using the examples ## -## Screenshots ## +**Step 1** -### Chart types -

- Chart Types -

+ Unzip the downloaded flutter example archive. -### Axis types -

- Axis Types -

+ **Note:** If you clone this repository ignore this step. + +**Step 2** + +Open the flutter example folder in an IDE. + +**Step 3** + +Run the following command to get the required packages. + +```dart +$ flutter pub get +``` + +**Step 4** + +Run your application using the following commands: + +**Windows & Linux** + +Run code: Ctrl + F5 + +Run with debugging: F5 or Run > Start Debugging + +Stop debugging: Shift + F5 + +Restart debugging: Ctrl + Shift + F5 -### User interactions +**MacOS** + +Run code: Cmd + F5 + +Run with debugging: F5 or Run > Start Debugging + +Stop debugging: Shift + Cmd + F5 + +Restart debugging: Cmd + Shift + F5 + +**Web (VS Code in the Browser)** + +Run code: Ctrl + F5 + +Run with debugging: F5 or Run > Start Debugging + +## Get the demo application + +Explore the full capabilities of our Flutter widgets on your device by installing our sample browser applications from the below app stores, and view samples code in GitHub. + +

+ + + +

- User Interaction + +

-## Disclaimer ## -Syncfusion has no liability for any damage or consequence that may arise by the use or viewing of the examples. The examples are for demonstrative purposes and if you choose to use or access the examples you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, accessing or otherwise viewing the examples. By accessing, viewing, or otherwise seeing the examples you acknowledge and agree Syncfusion’s examples will not allow you to seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize or otherwise do anything with Syncfusion’s examples. +## Useful links +Take a look at the following to learn more about Syncfusion® Flutter widgets: + +* [Syncfusion® Flutter product page](https://www.syncfusion.com/flutter-widgets) +* [User guide documentation](https://help.syncfusion.com/flutter/introduction/overview) +* [API reference](https://help.syncfusion.com/flutter/introduction/api-reference) +* [Knowledge base](https://www.syncfusion.com/kb/flutter) +* [Video tutorials](https://www.syncfusion.com/tutorial-videos/flutter) + +## Support and feedback + +* For any other queries, reach our [Syncfusion® support team](https://www.syncfusion.com/support/directtrac/incidents/newincident) or post the queries through the [Community forums](https://www.syncfusion.com/forums) and submit a feature request or a bug through our [Feedback portal](https://www.syncfusion.com/feedback/flutter). +* To renew the subscription, click [renew](https://www.syncfusion.com/sales/products) or contact our sales team at salessupport@syncfusion.com | Toll Free: 1-888-9 DOTNET. -## About Syncfusion ## -Founded in 2001 and headquartered in Research Triangle Park, N.C., Syncfusion has more than 20,000 customers and more than 1 million users, including large financial institutions, Fortune 500 companies, and global IT consultancies. +## About Syncfusion® -Today we provide 1,000+ controls and frameworks for web ([ASP.NET Core](https://www.syncfusion.com/aspnet-core-ui-controls), [ASP.NET MVC](https://www.syncfusion.com/aspnet-mvc-ui-controls), [ASP.NET WebForms](https://www.syncfusion.com/jquery/aspnet-web-forms-ui-controls), [JavaScript](https://www.syncfusion.com/javascript-ui-controls), [Angular](https://www.syncfusion.com/angular-ui-components), [React](https://www.syncfusion.com/react-ui-components), [Vue](https://www.syncfusion.com/vue-ui-components), and [Blazor](https://www.syncfusion.com/blazor-components), mobile ([Xamarin](https://www.syncfusion.com/xamarin-ui-controls), [Flutter](https://www.syncfusion.com/flutter-widgets), [UWP](https://www.syncfusion.com/uwp-ui-controls), and [JavaScript](https://www.syncfusion.com/javascript-ui-controls)), and desktop development ([WinForms](https://www.syncfusion.com/winforms-ui-controls), [WPF](https://www.syncfusion.com/products/wpf-ui-controls), and [UWP](https://www.syncfusion.com/uwp-ui-controls)). We provide ready-to deploy enterprise software for dashboards, reports, data integration, and big data processing. Many customers have saved millions in licensing fees by deploying our software. +Founded in 2001 and headquartered in Research Triangle Park, N.C., Syncfusion® has more than 20,000 customers and more than 1 million users, including large financial institutions, Fortune 500 companies, and global IT consultancies. +Today we provide 1,000+ controls and frameworks for web ([ASP.NET Core](https://www.syncfusion.com/aspnet-core-ui-controls), [ASP.NET MVC](https://www.syncfusion.com/aspnet-mvc-ui-controls), [ASP.NET WebForms](https://www.syncfusion.com/jquery/aspnet-web-forms-ui-controls), [JavaScript](https://www.syncfusion.com/javascript-ui-controls), [Angular](https://www.syncfusion.com/angular-ui-components), [React](https://www.syncfusion.com/react-ui-components), [Vue](https://www.syncfusion.com/vue-ui-components), and [Blazor](https://www.syncfusion.com/blazor-components), mobile ([Xamarin](https://www.syncfusion.com/xamarin-ui-controls), [Flutter](https://www.syncfusion.com/flutter-widgets), [UWP](https://www.syncfusion.com/uwp-ui-controls), and [JavaScript](https://www.syncfusion.com/javascript-ui-controls)), and desktop development ([WinForms](https://www.syncfusion.com/winforms-ui-controls), [WPF](https://www.syncfusion.com/wpf-ui-controls), and [UWP](https://www.syncfusion.com/uwp-ui-controls) and [WinUI](https://www.syncfusion.com/winui-controls)). We provide ready-to deploy enterprise software for dashboards, reports, data integration, and big data processing. Many customers have saved millions in licensing fees by deploying our software. diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 00000000..4e41b9f9 --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,10 @@ +Flutter - Read me + +To run the Flutter examples, please follow the below steps. + +* Click 'Explore Demo Source' button in Syncfusion control panel under Flutter menu. +* Navigate to the 'SampleBrowser' folder and open it using VS code or Android studio. +* Now get the required packages referred in the 'pubspec.yaml' file to run the project. +* Run the project by connecting an emulator or a physical device. + +Note - Android SDK 16 or later version is required to run the flutter examples. \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 00000000..1f1e4226 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,16 @@ +include: package:syncfusion_flutter_core/analysis_options.yaml + +analyzer: + errors: + include_file_not_found: ignore + lines_longer_than_80_chars: ignore + invalid_dependency: ignore + avoid_as: ignore + unnecessary_null_comparison: false + avoid_bool_literals_in_conditional_expressions: ignore + library_private_types_in_public_api: ignore + prefer_interpolation_to_compose_strings: ignore + always_specify_types: ignore + use_late_for_private_fields_and_variables: ignore + use_key_in_widget_constructors: ignore + diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 00000000..55afd919 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/.gradle/4.10.2/fileHashes/fileHashes.bin b/android/.gradle/4.10.2/fileHashes/fileHashes.bin index da905188..8a4da32d 100644 Binary files a/android/.gradle/4.10.2/fileHashes/fileHashes.bin and b/android/.gradle/4.10.2/fileHashes/fileHashes.bin differ diff --git a/android/.gradle/4.10.2/fileHashes/fileHashes.lock b/android/.gradle/4.10.2/fileHashes/fileHashes.lock index 398ca14e..79195eea 100644 Binary files a/android/.gradle/4.10.2/fileHashes/fileHashes.lock and b/android/.gradle/4.10.2/fileHashes/fileHashes.lock differ diff --git a/android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin b/android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin index 8563e9c3..66cda398 100644 Binary files a/android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin and b/android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin differ diff --git a/android/.gradle/4.10.2/javaCompile/classAnalysis.bin b/android/.gradle/4.10.2/javaCompile/classAnalysis.bin index ae15ade4..57798c4f 100644 Binary files a/android/.gradle/4.10.2/javaCompile/classAnalysis.bin and b/android/.gradle/4.10.2/javaCompile/classAnalysis.bin differ diff --git a/android/.gradle/4.10.2/javaCompile/jarAnalysis.bin b/android/.gradle/4.10.2/javaCompile/jarAnalysis.bin index 0c8e1f9e..043d629c 100644 Binary files a/android/.gradle/4.10.2/javaCompile/jarAnalysis.bin and b/android/.gradle/4.10.2/javaCompile/jarAnalysis.bin differ diff --git a/android/.gradle/4.10.2/javaCompile/javaCompile.lock b/android/.gradle/4.10.2/javaCompile/javaCompile.lock index 2706cd6b..3f1c98bf 100644 Binary files a/android/.gradle/4.10.2/javaCompile/javaCompile.lock and b/android/.gradle/4.10.2/javaCompile/javaCompile.lock differ diff --git a/android/.gradle/4.10.2/javaCompile/taskHistory.bin b/android/.gradle/4.10.2/javaCompile/taskHistory.bin index 1000dfb2..9f3e004b 100644 Binary files a/android/.gradle/4.10.2/javaCompile/taskHistory.bin and b/android/.gradle/4.10.2/javaCompile/taskHistory.bin differ diff --git a/android/.gradle/4.10.2/taskHistory/taskHistory.bin b/android/.gradle/4.10.2/taskHistory/taskHistory.bin index 4f57d896..80f6e9c1 100644 Binary files a/android/.gradle/4.10.2/taskHistory/taskHistory.bin and b/android/.gradle/4.10.2/taskHistory/taskHistory.bin differ diff --git a/android/.gradle/4.10.2/taskHistory/taskHistory.lock b/android/.gradle/4.10.2/taskHistory/taskHistory.lock deleted file mode 100644 index a052b6cd..00000000 Binary files a/android/.gradle/4.10.2/taskHistory/taskHistory.lock and /dev/null differ diff --git a/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 62df3d14..845b63a3 100644 Binary files a/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/android/.gradle/buildOutputCleanup/cache.properties b/android/.gradle/buildOutputCleanup/cache.properties index 4bab3493..d8c085d5 100644 --- a/android/.gradle/buildOutputCleanup/cache.properties +++ b/android/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ #Tue Jul 09 18:11:55 IST 2019 -gradle.version=4.10.2 +gradle.version=4.10.2 \ No newline at end of file diff --git a/android/.gradle/buildOutputCleanup/outputFiles.bin b/android/.gradle/buildOutputCleanup/outputFiles.bin index 43724c34..ecb203da 100644 Binary files a/android/.gradle/buildOutputCleanup/outputFiles.bin and b/android/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/android/app/build.gradle b/android/app/build.gradle index e8b5522e..ef2f8f92 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,61 +1,44 @@ -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' +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" } -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 28 + namespace = "com.syncfusion.flutter_examples" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } - lintOptions { - disable 'InvalidPackage' + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.syncfusion.flutter_examples" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + applicationId = "com.syncfusion.flutter_examples" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } 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 + signingConfig = signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + source = "../.." } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 3b6b28e7..399f6981 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e8a793fa..742a574e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,33 +1,52 @@ - - - + - + + android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" + android:value="true" /> + + + + + + + + + + + + diff --git a/android/app/src/main/java/com/syncfusion/flutter/flutter_examples/MainActivity.java b/android/app/src/main/java/com/syncfusion/flutter/flutter_examples/MainActivity.java deleted file mode 100644 index a61ea284..00000000 --- a/android/app/src/main/java/com/syncfusion/flutter/flutter_examples/MainActivity.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.syncfusion.flutter.flutter_examples; - -import android.os.Bundle; -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/android/app/src/main/java/com/syncfusion/flutter_examples/MainActivity.java b/android/app/src/main/java/com/syncfusion/flutter_examples/MainActivity.java index 8d95779e..9ed08f48 100644 --- a/android/app/src/main/java/com/syncfusion/flutter_examples/MainActivity.java +++ b/android/app/src/main/java/com/syncfusion/flutter_examples/MainActivity.java @@ -1,13 +1,80 @@ package com.syncfusion.flutter_examples; +import android.Manifest; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; import android.os.Bundle; -import io.flutter.app.FlutterActivity; + +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; +import androidx.core.content.PermissionChecker; + +import java.io.File; + +import androidx.annotation.NonNull; +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.engine.FlutterEngine; +import io.flutter.plugin.common.MethodChannel; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); + + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), "launchFile") + .setMethodCallHandler( + (call, result) -> { + if (call.method.equals("viewPdf") || call.method.equals("viewExcel")) { + String path = call.argument("file_path"); + if(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU && !checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)){ + requestPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}); + } else { + launchFile(path); + } + } + } + ); + } + private void requestPermission(String[] permission){ + ActivityCompat.requestPermissions(this, permission, 1); + } + private boolean checkPermission(String permission) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + return true; + } else { + if (ContextCompat.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED) { + return true; + } else { + return false; + } + } + } + private void launchFile(String filePath){ + File file = new File(filePath); + if(file.exists()){ + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.addCategory("android.intent.category.DEFAULT"); + Uri uri = null; + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + String packageName = this.getPackageName(); + uri = FileProvider.getUriForFile(this, packageName + ".fileProvider", new File(filePath)); + }else { + uri = Uri.fromFile(file); + } + if(filePath.contains(".pdf")) + intent.setDataAndType(uri, "application/pdf"); + else + intent.setDataAndType(uri, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + try{ + this.startActivity(intent); + }catch (Exception e){ + //Could not launch the file. + } + } } } diff --git a/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java index cf002ebc..5df48af7 100644 --- a/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java +++ b/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -1,6 +1,7 @@ package io.flutter.plugins; import io.flutter.plugin.common.PluginRegistry; +import io.flutter.plugins.pathprovider.PathProviderPlugin; import io.flutter.plugins.urllauncher.UrlLauncherPlugin; /** @@ -11,6 +12,7 @@ public static void registerWith(PluginRegistry registry) { if (alreadyRegisteredWith(registry)) { return; } + PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); UrlLauncherPlugin.registerWith(registry.registrarFor("io.flutter.plugins.urllauncher.UrlLauncherPlugin")); } diff --git a/android/app/src/main/kotlin/com/example/flutter_examples/MainActivity.kt b/android/app/src/main/kotlin/com/example/flutter_examples/MainActivity.kt new file mode 100644 index 00000000..4c80816e --- /dev/null +++ b/android/app/src/main/kotlin/com/example/flutter_examples/MainActivity.kt @@ -0,0 +1,79 @@ +package com.syncfusion.flutter_examples + +import android.Manifest +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.os.Bundle +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat +import androidx.core.content.FileProvider +import androidx.core.content.PermissionChecker +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodChannel +import java.io.File + +class MainActivity : FlutterActivity() { + private val CHANNEL = "launchFile" + + override fun configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result -> + when (call.method) { + "viewPdf", "viewExcel" -> { + val path: String? = call.argument("file_path") + if (path != null) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU && !checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) { + requestPermission(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE)) + } else { + launchFile(path) + } + } else { + result.error("INVALID_PATH", "File path is null", null) + } + } + else -> result.notImplemented() + } + } + } + + private fun requestPermission(permissions: Array) { + ActivityCompat.requestPermissions(this, permissions, 1) + } + + private fun checkPermission(permission: String): Boolean { + return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + true + } else { + ContextCompat.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED + } + } + + private fun launchFile(filePath: String) { + val file = File(filePath) + if (file.exists()) { + val intent = Intent(Intent.ACTION_VIEW) + intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP + intent.addCategory(Intent.CATEGORY_DEFAULT) + val uri: Uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + val packageName = this.packageName + FileProvider.getUriForFile(this, "$packageName.fileProvider", file) + } else { + Uri.fromFile(file) + } + + intent.setDataAndType( + uri, + if (filePath.contains(".pdf")) "application/pdf" else "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + ) + + try { + startActivity(intent) + } catch (e: Exception) { + // Could not launch the file. + } + } + } +} diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml index 7f8ad4a3..304732f8 100644 --- a/android/app/src/main/res/drawable/launch_background.xml +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -4,8 +4,9 @@ - + diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 00fa4417..cb1ef880 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/android/app/src/main/res/xml/provider_path.xml b/android/app/src/main/res/xml/provider_path.xml new file mode 100644 index 00000000..e8754504 --- /dev/null +++ b/android/app/src/main/res/xml/provider_path.xml @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 3b6b28e7..399f6981 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/build.gradle b/android/build.gradle index bb8a3038..d2ffbffa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,29 +1,18 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - } -} - allprojects { repositories { google() - jcenter() + mavenCentral() } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/flutter_examples_android.iml b/android/flutter_examples_android.iml index 269c4d74..18999696 100644 --- a/android/flutter_examples_android.iml +++ b/android/flutter_examples_android.iml @@ -4,6 +4,8 @@