Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 13 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:label="Syncfusion Flutter UI Widgets"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:allowBackup="false">
<!-- Properly configure the ProfileInstallReceiver -->
<receiver
android:name="androidx.profileinstaller.ProfileInstallReceiver"
tools:replace="android:exported"
android:exported="false"> <!-- Exported false for security -->
<intent-filter>
<action android:name="com.example.ACTION_INSTALL_PROFILE"/>
</intent-filter>
</receiver>
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class MainActivity : FlutterActivity() {
private fun launchFile(filePath: String) {
val file = File(filePath)
if (file.exists()) {
// Check if the file is sensitive
if (isSensitiveFile(file)) {
// Deny opening sensitive files for now; handle as per your requirements
return
}

val intent = Intent(Intent.ACTION_VIEW)
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
intent.addCategory(Intent.CATEGORY_DEFAULT)
Expand All @@ -76,4 +82,15 @@ class MainActivity : FlutterActivity() {
}
}
}

// Check whether the file is sensitive (simple logic: is in cache or temp or matches special name)
private fun isSensitiveFile(file: File): Boolean {
val sensitivePaths = listOf("cache", "temp")
val pathLower = file.absolutePath.lowercase()
if (sensitivePaths.any { pathLower.contains(it) }) return true
val sensitiveExtensions = listOf(".key", ".pem", ".p12", ".crt")
if (sensitiveExtensions.any { pathLower.endsWith(it) }) return true
// Add further logic as needed for your use case
return false
}
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
4 changes: 2 additions & 2 deletions android/local.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sdk.dir=C:\\Users\\HariharasudhanKanaga\\AppData\\Local\\Android\\Sdk
flutter.sdk=D:\\Flutter-3.27.0\\flutter\\bin\\flutter
sdk.dir=C:\\Users\\AswiniSureshReddy\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\flutter
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "com.android.application" version "8.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

Expand Down
11 changes: 11 additions & 0 deletions lib/meta_tag/meta_tag.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export 'meta_tag_default.dart' if (dart.library.js_interop) 'meta_tag_web.dart';

/// This is the base structure for changing the sample title and meta tags.
abstract class MetaTagUpdate {
/// This method changes the meta tag title based on the
/// selected sample and widget title.
void update(String sampleTitle, String widgetTitle);

/// This method resets meta tag title to a default value.
void setDefault();
}
11 changes: 11 additions & 0 deletions lib/meta_tag/meta_tag_default.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'meta_tag.dart';

/// This class is used when the sample is not running in a web browser; meta
/// tag updates are only for web.
class WebMetaTagUpdate implements MetaTagUpdate {
@override
void update(String sampleTitle, String widgetTitle) {}

@override
void setDefault() {}
}
56 changes: 56 additions & 0 deletions lib/meta_tag/meta_tag_web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:web/web.dart' as web;

import 'meta_tag.dart';

/// This class is used when the sample runs in a web browser.
/// Implements meta tag updates for samples running in web browsers.
class WebMetaTagUpdate implements MetaTagUpdate {
static const String _defaultMetaTitle =
'Demos & Examples of Syncfusion Flutter Widgets';

/// This method updates the meta tag using the sample and widget names.
@override
void update(String sampleTitle, String widgetTitle) {
final String formattedTitle = '$sampleTitle - $widgetTitle';
WidgetsBinding.instance.addPostFrameCallback((_) {
_updateMetaTags(formattedTitle);
});
}

/// Resets meta tags to the default value.
@override
void setDefault() {
_updateMetaTags(_defaultMetaTitle);
}

/// Updates the meta tags if the title is valid and not already set.
void _updateMetaTags(String title) {
if (title.isEmpty || web.document.title == title) {
return;
}
web.document.title = title;
_setMeta('og:title', title);
}

/// This method finds the meta tag by name or property and updates it.
/// If the tag does not exist, it creates a new one and adds it to the page.
void _setMeta(String name, String content) {
if (name.isEmpty || content.isEmpty) {
return;
}

web.HTMLMetaElement? metaTag =
web.document.head?.querySelector(
'meta[property="$name"], meta[name="$name"]',
)
as web.HTMLMetaElement?;

if (metaTag == null) {
metaTag = web.document.createElement('meta') as web.HTMLMetaElement;
metaTag.setAttribute('property', name);
web.document.head?.append(metaTag);
}
metaTag.content = content;
}
}
10 changes: 10 additions & 0 deletions lib/model/helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

/// Local imports
import '../meta_tag/meta_tag.dart';
import '../widgets/bottom_sheet.dart';
import '../widgets/search_bar.dart';
import 'mobile_view.dart';
import 'model.dart';
import 'sample_view.dart';

final WebMetaTagUpdate metaTagUpdate = WebMetaTagUpdate();

/// Callback for changing the theme.
typedef ChangeThemeCallback =
void Function(bool isMaterial3, Brightness brightness);
Expand Down Expand Up @@ -81,6 +84,13 @@ void onTapControlInWeb(
: category.controlList![category.selectedIndex!].subItems[0] as SubItem;

Navigator.pushNamed(context, subItem.breadCrumbText!);

// Updates meta tag details when navigating from the home page
// to a widget sample page.
metaTagUpdate.update(
subItem.title!,
category.controlList![category.selectedIndex!].subItems[0].title,
);
}

/// On tap the expand button, get the fullview sample.
Expand Down
51 changes: 10 additions & 41 deletions lib/model/showcase_application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class ShowcaseApplications extends StatelessWidget {
double width,
) {
final String imagePath = _imagePathBasedOnTheme(app.title);
final String status = app.title == 'Expense Tracker' ? 'Updated' : 'New';
return Container(
decoration: BoxDecoration(
color: model.homeCardColor,
Expand Down Expand Up @@ -232,46 +231,16 @@ class ShowcaseApplications extends StatelessWidget {
top: 16.0,
bottom: 16.0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
app.title,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.titleMedium!
.copyWith(
color: Theme.of(context).colorScheme.onSurface,
letterSpacing: 0,
fontFamily: 'Roboto',
fontWeight: FontWeight.w700,
),
),
),
Container(
decoration: BoxDecoration(
color: status.toLowerCase() == 'new'
? const Color.fromRGBO(55, 153, 30, 1)
: status.toLowerCase() == 'updated'
? const Color.fromRGBO(246, 117, 0, 1)
: Colors.transparent,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(10.0),
topLeft: Radius.circular(10.0),
),
),
padding: const EdgeInsets.fromLTRB(5, 2.7, 5, 2.7),
child: Text(
status,
style: const TextStyle(
fontSize: 10.5,
fontFamily: 'Roboto-Medium',
color: Colors.white,
),
),
),
],
child: Text(
app.title,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: Theme.of(context).colorScheme.onSurface,
letterSpacing: 0,
fontFamily: 'Roboto',
fontWeight: FontWeight.w700,
),
),
),
],
Expand Down
Loading