Skip to content

Commit ca71679

Browse files
sample browser changes.
1 parent acce281 commit ca71679

File tree

61 files changed

+2036
-1078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2036
-1078
lines changed

README.md

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,16 @@
1-
# Syncfusion Flutter Examples
1+
# flutter_examples
22

3-
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.
3+
This project contains the Syncfusion Flutter UI widgets examples.
44

5-
![showcase_image](https://cdn.syncfusion.com/content/images/FTControl/screen2.png)
5+
## Getting Started
66

7-
This section guides you how to use the Syncfusion Flutter examples in your applications.
7+
This project is a starting point for a Flutter application.
88

9-
## Table of contents
9+
A few resources to get you started if this is your first Flutter project:
1010

11-
* [Requirements to run the demo](#requirements-to-run-the-demo)
12-
* [Repository structure](#repository-structure)
13-
* [Using the samples](#using-the-samples)
14-
* [Support and feedback](#support-and-feedback)
15-
* [Screenshots](#screenshots)
16-
* [Disclaimer](#disclaimer)
17-
* [About Syncfusion](#about-syncfusion)
18-
19-
## <a name="requirements-to-run-the-demo"></a>Requirements to run the demo ##
20-
21-
* [Flutter SDK](https://flutter.dev/docs/get-started/install/windows)
22-
* [Android studio](https://developer.android.com/studio/install) or [Visual studio code](https://code.visualstudio.com/download)
23-
* Install Flutter extension in Android studio or in [VS code](https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter)
24-
25-
## <a name="repository-structure"></a>Repository structure ##
26-
27-
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.
28-
29-
## <a name="using-the-samples"></a>Using the samples ##
30-
31-
* Download or clone the files in repository.
32-
* Get the required packages referred in the project.
33-
34-
## <a name="support-and-feedback"></a>Support and Feedback ##
35-
36-
* 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).
37-
* 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 <salessupport@syncfusion.com>.
38-
39-
## <a name='screenshots'></a>Screenshots ##
40-
41-
### Chart types
42-
<p align="center">
43-
<img src="https://cdn.syncfusion.com/content/images/FTControl/chartTypes.png" alt="Chart Types"/>
44-
</p>
45-
46-
### Axis types
47-
<p align="center">
48-
<img src="https://cdn.syncfusion.com/content/images/FTControl/axisTypes.png" alt="Axis Types"/>
49-
</p>
50-
51-
### User interactions
52-
<p align="center">
53-
<img src="https://cdn.syncfusion.com/content/images/FTControl/userInteraction.gif" alt="User Interaction"/>
54-
</p>
55-
56-
## <a name="disclaimer"></a>Disclaimer ##
57-
58-
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.
59-
60-
## <a name="about-syncfusion"></a>About Syncfusion ##
61-
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.
62-
63-
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.
11+
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
6413

14+
For help getting started with Flutter, view our
15+
[online documentation](https://flutter.dev/docs), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

android/app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.syncfusion.flutter_examples">
3-
3+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
4+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
45
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
56
calls FlutterMain.startInitialization(this); in its onCreate method.
67
In most cases you can leave this as-is, but you if you want to provide
@@ -10,6 +11,15 @@
1011
android:name="io.flutter.app.FlutterApplication"
1112
android:label="Syncfusion Flutter UI Widgets"
1213
android:icon="@mipmap/ic_launcher">
14+
<provider
15+
android:name="androidx.core.content.FileProvider"
16+
android:authorities="${applicationId}.fileProvider"
17+
android:exported="false"
18+
android:grantUriPermissions="true">
19+
<meta-data
20+
android:name="android.support.FILE_PROVIDER_PATHS"
21+
android:resource="@xml/provider_path"/>
22+
</provider>
1323
<activity
1424
android:name=".MainActivity"
1525
android:launchMode="singleTop"

android/app/src/main/java/com/syncfusion/flutter/flutter_examples/MainActivity.java

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,76 @@
11
package com.syncfusion.flutter_examples;
22

3+
import android.Manifest;
4+
import android.content.Intent;
5+
import android.net.Uri;
6+
import android.os.Build;
37
import android.os.Bundle;
8+
9+
import androidx.core.app.ActivityCompat;
10+
import androidx.core.content.ContextCompat;
11+
import androidx.core.content.FileProvider;
12+
import androidx.core.content.PermissionChecker;
13+
14+
import java.io.File;
15+
416
import io.flutter.app.FlutterActivity;
17+
import io.flutter.plugin.common.MethodCall;
18+
import io.flutter.plugin.common.MethodChannel;
519
import io.flutter.plugins.GeneratedPluginRegistrant;
620

721
public class MainActivity extends FlutterActivity {
822
@Override
923
protected void onCreate(Bundle savedInstanceState) {
1024
super.onCreate(savedInstanceState);
1125
GeneratedPluginRegistrant.registerWith(this);
26+
new MethodChannel(getFlutterView(), "launchFile").setMethodCallHandler(new MethodChannel.MethodCallHandler() {
27+
@Override
28+
public void onMethodCall(MethodCall call, MethodChannel.Result result) {
29+
if (call.method.equals("viewPdf")) {
30+
String path = call.argument("file_path");
31+
if(!checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)){
32+
requestPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE});
33+
} else {
34+
launchFile(path);
35+
}
36+
}
37+
}
38+
});
39+
}
40+
private void requestPermission(String[] permission){
41+
ActivityCompat.requestPermissions(this, permission, 1);
42+
}
43+
private boolean checkPermission(String permission) {
44+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
45+
return true;
46+
} else {
47+
if (ContextCompat.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED) {
48+
return true;
49+
} else {
50+
return false;
51+
}
52+
}
53+
}
54+
private void launchFile(String filePath){
55+
File file = new File(filePath);
56+
if(file.exists()){
57+
Intent intent = new Intent(Intent.ACTION_VIEW);
58+
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
59+
intent.addCategory("android.intent.category.DEFAULT");
60+
Uri uri = null;
61+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
62+
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
63+
String packageName = this.getPackageName();
64+
uri = FileProvider.getUriForFile(this, packageName + ".fileProvider", new File(filePath));
65+
}else {
66+
uri = Uri.fromFile(file);
67+
}
68+
intent.setDataAndType(uri, "application/pdf");
69+
try{
70+
this.startActivity(intent);
71+
}catch (Exception e){
72+
//Could not launch the file.
73+
}
74+
}
1275
}
1376
}

android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.flutter.plugins;
22

33
import io.flutter.plugin.common.PluginRegistry;
4+
import io.flutter.plugins.pathprovider.PathProviderPlugin;
45
import io.flutter.plugins.urllauncher.UrlLauncherPlugin;
56

67
/**
@@ -11,6 +12,7 @@ public static void registerWith(PluginRegistry registry) {
1112
if (alreadyRegisteredWith(registry)) {
1213
return;
1314
}
15+
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
1416
UrlLauncherPlugin.registerWith(registry.registrarFor("io.flutter.plugins.urllauncher.UrlLauncherPlugin"));
1517
}
1618

android/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536M
22

3+
android.enableR8=true
4+
5+
android.useAndroidX=true
6+
android.enableJetifier=true

android/local.properties

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
sdk.dir=/Users/ashwink/Library/Android/sdk
2-
flutter.sdk=/Users/ashwink/Documents/FlutterSDK/flutter
1+
sdk.dir=C:\\Users\\Nandhini\\AppData\\Local\\Android\\sdk
2+
flutter.sdk=D:\\flutter\\flutter
33
flutter.buildMode=debug
4-
flutter.versionName=1.0.0
5-
flutter.versionCode=1
4+
flutter.versionName=17.4.39

assets/fonts/Montserrat-Bold.ttf

-255 KB
Binary file not shown.

assets/fonts/Montserrat-Medium.ttf

-254 KB
Binary file not shown.

images/code.png

518 Bytes
Loading

images/info.png

690 Bytes
Loading

ios/Runner/AppDelegate.m

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,43 @@
22
#include "GeneratedPluginRegistrant.h"
33

44
@implementation AppDelegate
5-
5+
UIDocumentInteractionController* _uiController;
66
- (BOOL)application:(UIApplication *)application
77
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8+
FlutterViewController* controller =(FlutterViewController*) self.window.rootViewController;
9+
10+
FlutterMethodChannel* viewPdfFileChannel = [FlutterMethodChannel methodChannelWithName:@"launchFile" binaryMessenger: controller];
11+
12+
[viewPdfFileChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
13+
if ([@"viewPdf" isEqualToString:call.method]) {
14+
NSString* filePath = call.arguments[@"file_path"];
15+
NSFileManager* fileManager = [NSFileManager defaultManager];
16+
BOOL fileExist = [fileManager fileExistsAtPath:filePath];
17+
if(fileExist){
18+
NSString* fileExtension = [filePath pathExtension];
19+
_uiController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
20+
_uiController.delegate = self;
21+
if([fileExtension isEqualToString:@"pdf"]){
22+
_uiController.UTI = @"com.adobe.pdf";
23+
}
24+
else if([fileExtension isEqualToString:@"txt"]){
25+
_uiController.UTI = @"public.plain-text";
26+
}
27+
else{
28+
NSLog(@"The format %@ is not supported ", filePath);
29+
}
30+
@try {
31+
BOOL isPreview = [_uiController presentPreviewAnimated:YES];
32+
if(!isPreview){
33+
[_uiController presentOpenInMenuFromRect:CGRectMake(200, 20, 100, 100) inView: controller.view animated:YES];
34+
}
35+
36+
} @catch (NSException *exception) {
37+
NSLog(@"%@", exception);
38+
}
39+
}
40+
}
41+
}];
842
[GeneratedPluginRegistrant registerWithRegistry:self];
943
// Override point for customization after application launch.
1044
return [super application:application didFinishLaunchingWithOptions:launchOptions];

ios/Runner/GeneratedPluginRegistrant.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88
#import <Flutter/Flutter.h>
99

10+
NS_ASSUME_NONNULL_BEGIN
11+
1012
@interface GeneratedPluginRegistrant : NSObject
1113
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
1214
@end
1315

16+
NS_ASSUME_NONNULL_END
1417
#endif /* GeneratedPluginRegistrant_h */

ios/Runner/GeneratedPluginRegistrant.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@
33
//
44

55
#import "GeneratedPluginRegistrant.h"
6-
#import <url_launcher/UrlLauncherPlugin.h>
6+
7+
#if __has_include(<path_provider/FLTPathProviderPlugin.h>)
8+
#import <path_provider/FLTPathProviderPlugin.h>
9+
#else
10+
@import path_provider;
11+
#endif
12+
13+
#if __has_include(<url_launcher/FLTURLLauncherPlugin.h>)
14+
#import <url_launcher/FLTURLLauncherPlugin.h>
15+
#else
16+
@import url_launcher;
17+
#endif
718

819
@implementation GeneratedPluginRegistrant
920

1021
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
11-
[FLTUrlLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTUrlLauncherPlugin"]];
22+
[FLTPathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTPathProviderPlugin"]];
23+
[FLTURLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTURLLauncherPlugin"]];
1224
}
1325

1426
@end

lib/model/model.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class SampleModel extends Model {
139139
Color bottomSheetBackgroundColor = Colors.white;
140140
final bool isTileView = true;
141141
Color cardThemeColor = Colors.white;
142+
bool isWeb = false;
142143

143144
void changeTheme(ThemeData _themeData) {
144145
themeData = _themeData;
@@ -185,8 +186,7 @@ class SampleModel extends Model {
185186
Future<void> updateControl() async {
186187
bool isSample = false;
187188
bool isChild = false;
188-
final String jsonText =
189-
await rootBundle.loadString('lib/sample_details.json');
189+
final String jsonText = await rootBundle.loadString('lib/sample_details.json');
190190
final List<dynamic> controlList = json.decode(jsonText);
191191
List<SubItem> subItems = <SubItem>[];
192192
List<SubItem> subItems1 = <SubItem>[];
@@ -243,7 +243,7 @@ class ChartSampleData {
243243
this.yValue3,
244244
this.pointColor,
245245
this.size,
246-
this.text});
246+
this.text,this.open,this.close});
247247
final dynamic x;
248248
final num y;
249249
final dynamic xValue;
@@ -253,4 +253,6 @@ class ChartSampleData {
253253
final Color pointColor;
254254
final num size;
255255
final String text;
256+
final num open;
257+
final num close;
256258
}

0 commit comments

Comments
 (0)