Skip to content

Commit 2b052bd

Browse files
Merge pull request #902 from natrayansf/master
Moved the Volume 4, 2025 release source changes to the flutter examples repository
2 parents 92c6f53 + c7025cf commit 2b052bd

File tree

437 files changed

+23556
-3207
lines changed

Some content is hidden

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

437 files changed

+23556
-3207
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools">
23
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
34
<application
45
android:label="Syncfusion Flutter UI Widgets"
56
android:name="${applicationName}"
6-
android:icon="@mipmap/ic_launcher">
7+
android:icon="@mipmap/ic_launcher"
8+
android:allowBackup="false">
9+
<!-- Properly configure the ProfileInstallReceiver -->
10+
<receiver
11+
android:name="androidx.profileinstaller.ProfileInstallReceiver"
12+
tools:replace="android:exported"
13+
android:exported="false"> <!-- Exported false for security -->
14+
<intent-filter>
15+
<action android:name="com.example.ACTION_INSTALL_PROFILE"/>
16+
</intent-filter>
17+
</receiver>
718
<activity
819
android:name=".MainActivity"
920
android:exported="true"

android/app/src/main/kotlin/com/example/flutter_examples/MainActivity.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ class MainActivity : FlutterActivity() {
5353
private fun launchFile(filePath: String) {
5454
val file = File(filePath)
5555
if (file.exists()) {
56+
// Check if the file is sensitive
57+
if (isSensitiveFile(file)) {
58+
// Deny opening sensitive files for now; handle as per your requirements
59+
return
60+
}
61+
5662
val intent = Intent(Intent.ACTION_VIEW)
5763
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
5864
intent.addCategory(Intent.CATEGORY_DEFAULT)
@@ -76,4 +82,15 @@ class MainActivity : FlutterActivity() {
7682
}
7783
}
7884
}
85+
86+
// Check whether the file is sensitive (simple logic: is in cache or temp or matches special name)
87+
private fun isSensitiveFile(file: File): Boolean {
88+
val sensitivePaths = listOf("cache", "temp")
89+
val pathLower = file.absolutePath.lowercase()
90+
if (sensitivePaths.any { pathLower.contains(it) }) return true
91+
val sensitiveExtensions = listOf(".key", ".pem", ".p12", ".crt")
92+
if (sensitiveExtensions.any { pathLower.endsWith(it) }) return true
93+
// Add further logic as needed for your use case
94+
return false
95+
}
7996
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

android/local.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sdk.dir=C:\\Users\\HariharasudhanKanaga\\AppData\\Local\\Android\\Sdk
2-
flutter.sdk=D:\\Flutter-3.27.0\\flutter\\bin\\flutter
1+
sdk.dir=C:\\Users\\AswiniSureshReddy\\AppData\\Local\\Android\\sdk
2+
flutter.sdk=C:\\flutter

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "8.1.0" apply false
21+
id "com.android.application" version "8.3.0" apply false
2222
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

lib/meta_tag/meta_tag.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export 'meta_tag_default.dart' if (dart.library.js_interop) 'meta_tag_web.dart';
2+
3+
/// This is the base structure for changing the sample title and meta tags.
4+
abstract class MetaTagUpdate {
5+
/// This method changes the meta tag title based on the
6+
/// selected sample and widget title.
7+
void update(String sampleTitle, String widgetTitle);
8+
9+
/// This method resets meta tag title to a default value.
10+
void setDefault();
11+
}

lib/meta_tag/meta_tag_default.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import 'meta_tag.dart';
2+
3+
/// This class is used when the sample is not running in a web browser; meta
4+
/// tag updates are only for web.
5+
class WebMetaTagUpdate implements MetaTagUpdate {
6+
@override
7+
void update(String sampleTitle, String widgetTitle) {}
8+
9+
@override
10+
void setDefault() {}
11+
}

lib/meta_tag/meta_tag_web.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:web/web.dart' as web;
3+
4+
import 'meta_tag.dart';
5+
6+
/// This class is used when the sample runs in a web browser.
7+
/// Implements meta tag updates for samples running in web browsers.
8+
class WebMetaTagUpdate implements MetaTagUpdate {
9+
static const String _defaultMetaTitle =
10+
'Demos & Examples of Syncfusion Flutter Widgets';
11+
12+
/// This method updates the meta tag using the sample and widget names.
13+
@override
14+
void update(String sampleTitle, String widgetTitle) {
15+
final String formattedTitle = '$sampleTitle - $widgetTitle';
16+
WidgetsBinding.instance.addPostFrameCallback((_) {
17+
_updateMetaTags(formattedTitle);
18+
});
19+
}
20+
21+
/// Resets meta tags to the default value.
22+
@override
23+
void setDefault() {
24+
_updateMetaTags(_defaultMetaTitle);
25+
}
26+
27+
/// Updates the meta tags if the title is valid and not already set.
28+
void _updateMetaTags(String title) {
29+
if (title.isEmpty || web.document.title == title) {
30+
return;
31+
}
32+
web.document.title = title;
33+
_setMeta('og:title', title);
34+
}
35+
36+
/// This method finds the meta tag by name or property and updates it.
37+
/// If the tag does not exist, it creates a new one and adds it to the page.
38+
void _setMeta(String name, String content) {
39+
if (name.isEmpty || content.isEmpty) {
40+
return;
41+
}
42+
43+
web.HTMLMetaElement? metaTag =
44+
web.document.head?.querySelector(
45+
'meta[property="$name"], meta[name="$name"]',
46+
)
47+
as web.HTMLMetaElement?;
48+
49+
if (metaTag == null) {
50+
metaTag = web.document.createElement('meta') as web.HTMLMetaElement;
51+
metaTag.setAttribute('property', name);
52+
web.document.head?.append(metaTag);
53+
}
54+
metaTag.content = content;
55+
}
56+
}

lib/model/helper.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ import 'package:flutter/material.dart';
99
import 'package:url_launcher/url_launcher.dart';
1010

1111
/// Local imports
12+
import '../meta_tag/meta_tag.dart';
1213
import '../widgets/bottom_sheet.dart';
1314
import '../widgets/search_bar.dart';
1415
import 'mobile_view.dart';
1516
import 'model.dart';
1617
import 'sample_view.dart';
1718

19+
final WebMetaTagUpdate metaTagUpdate = WebMetaTagUpdate();
20+
1821
/// Callback for changing the theme.
1922
typedef ChangeThemeCallback =
2023
void Function(bool isMaterial3, Brightness brightness);
@@ -81,6 +84,13 @@ void onTapControlInWeb(
8184
: category.controlList![category.selectedIndex!].subItems[0] as SubItem;
8285

8386
Navigator.pushNamed(context, subItem.breadCrumbText!);
87+
88+
// Updates meta tag details when navigating from the home page
89+
// to a widget sample page.
90+
metaTagUpdate.update(
91+
subItem.title!,
92+
category.controlList![category.selectedIndex!].subItems[0].title,
93+
);
8494
}
8595

8696
/// On tap the expand button, get the fullview sample.

lib/model/showcase_application.dart

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ class ShowcaseApplications extends StatelessWidget {
173173
double width,
174174
) {
175175
final String imagePath = _imagePathBasedOnTheme(app.title);
176-
final String status = app.title == 'Expense Tracker' ? 'Updated' : 'New';
177176
return Container(
178177
decoration: BoxDecoration(
179178
color: model.homeCardColor,
@@ -232,46 +231,16 @@ class ShowcaseApplications extends StatelessWidget {
232231
top: 16.0,
233232
bottom: 16.0,
234233
),
235-
child: Row(
236-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
237-
children: [
238-
Expanded(
239-
child: Text(
240-
app.title,
241-
overflow: TextOverflow.ellipsis,
242-
textAlign: TextAlign.start,
243-
style: Theme.of(context).textTheme.titleMedium!
244-
.copyWith(
245-
color: Theme.of(context).colorScheme.onSurface,
246-
letterSpacing: 0,
247-
fontFamily: 'Roboto',
248-
fontWeight: FontWeight.w700,
249-
),
250-
),
251-
),
252-
Container(
253-
decoration: BoxDecoration(
254-
color: status.toLowerCase() == 'new'
255-
? const Color.fromRGBO(55, 153, 30, 1)
256-
: status.toLowerCase() == 'updated'
257-
? const Color.fromRGBO(246, 117, 0, 1)
258-
: Colors.transparent,
259-
borderRadius: const BorderRadius.only(
260-
bottomLeft: Radius.circular(10.0),
261-
topLeft: Radius.circular(10.0),
262-
),
263-
),
264-
padding: const EdgeInsets.fromLTRB(5, 2.7, 5, 2.7),
265-
child: Text(
266-
status,
267-
style: const TextStyle(
268-
fontSize: 10.5,
269-
fontFamily: 'Roboto-Medium',
270-
color: Colors.white,
271-
),
272-
),
273-
),
274-
],
234+
child: Text(
235+
app.title,
236+
overflow: TextOverflow.ellipsis,
237+
textAlign: TextAlign.start,
238+
style: Theme.of(context).textTheme.titleMedium!.copyWith(
239+
color: Theme.of(context).colorScheme.onSurface,
240+
letterSpacing: 0,
241+
fontFamily: 'Roboto',
242+
fontWeight: FontWeight.w700,
243+
),
275244
),
276245
),
277246
],

0 commit comments

Comments
 (0)