Skip to content

Commit 0ad583f

Browse files
committed
initial commit
0 parents  commit 0ad583f

File tree

81 files changed

+19601
-0
lines changed

Some content is hidden

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

81 files changed

+19601
-0
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# name: Build Flutter on Rails
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - main
7+
8+
# jobs:
9+
# build:
10+
# name: Build iOS and Android
11+
# runs-on: macos-latest
12+
# env:
13+
# CI: true
14+
15+
# steps:
16+
# - name: Checkout repository
17+
# uses: actions/checkout@v3
18+
19+
# # Set up Flutter
20+
# - name: Set up Flutter
21+
# uses: subosito/flutter-action@v2
22+
# with:
23+
# flutter-version: '3.24.3' # Specify the Flutter version you need
24+
25+
# - name: Install dependencies
26+
# run: flutter pub get
27+
28+
# # Build Android APK
29+
# - name: Build Android APK
30+
# run: flutter build apk --release
31+
32+
# # Upload Android APK
33+
# - name: Upload Android APK
34+
# uses: actions/upload-artifact@v3
35+
# with:
36+
# name: android-apk
37+
# path: build/app/outputs/flutter-apk/app-release.apk
38+
39+
# # Set up Xcode and CocoaPods for iOS
40+
# - name: Set up Xcode
41+
# run: |
42+
# sudo gem install cocoapods
43+
# cd ios
44+
# pod install
45+
46+
# # Build iOS app
47+
# - name: Build iOS App
48+
# run: flutter build ios --release --no-codesign
49+
50+
# # Upload iOS Build (IPA file)
51+
# - name: Upload iOS Build
52+
# uses: actions/upload-artifact@v3
53+
# with:
54+
# name: ios-build
55+
# path: build/ios/iphoneos/Runner.app # Adjust this path if you export IPA later

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
.flutter-plugins
30+
.flutter-plugins-dependencies
31+
build/

.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
8+
channel: "stable"
9+
10+
project_type: package

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
* TODO: Describe initial release.

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!--
2+
This README describes the package. If you publish this package to pub.dev,
3+
this README's contents appear on the landing page for your package.
4+
5+
For information about how to write a good package README, see the guide for
6+
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
7+
8+
For general information about developing packages, see the Dart guide for
9+
[creating packages](https://dart.dev/guides/libraries/create-packages)
10+
and the Flutter guide for
11+
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12+
-->
13+
14+
TODO: Put a short description of the package here that helps potential users
15+
know whether this package might be useful for them.
16+
17+
## Features
18+
19+
TODO: List what your package can do. Maybe include images, gifs, or videos.
20+
21+
## Getting started
22+
23+
TODO: List prerequisites and provide or point to information on how to
24+
start using the package.
25+
26+
## Usage
27+
28+
TODO: Include short and useful examples for package users. Add longer examples
29+
to `/example` folder.
30+
31+
```dart
32+
const like = 'sample';
33+
```
34+
35+
## Additional information
36+
37+
TODO: Tell users more about the package: where to find more information, how to
38+
contribute to the package, how to file issues, what response they can expect
39+
from the package authors, and more.

analysis_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import 'package:flutterx/imports/exports.dart';
2+
import '../assets/grouped_icons.dart';
3+
4+
NavigationBar? buildBottomNavigationBar(AppNotifier provider, String url) {
5+
return (provider.state.links.length > 1)
6+
? NavigationBar(
7+
// backgroundColor: hexToColor("#4285F4"),
8+
destinations: [
9+
for (var item in provider.state.links)
10+
NavigationDestination(
11+
tooltip: item['tooltip'],
12+
selectedIcon:
13+
groupedIcons['selectedIcon'] == null
14+
? null
15+
: Icon(groupedIcons['selectedIcon']),
16+
icon: Icon(
17+
groupedIcons[item['icon']!.toLowerCase()] ??
18+
groupedIcons['info'],
19+
),
20+
label: item['label']!.toUpperCase(),
21+
),
22+
],
23+
selectedIndex:
24+
provider
25+
.state
26+
.index, // Set the current index for the BottomNavigationBar
27+
onDestinationSelected: (selectedIndex) async {
28+
provider.setIndex(selectedIndex);
29+
url = provider.state.links[provider.state.index]['url'];
30+
// Load the corresponding URL in the WebView
31+
if (provider.state.controller != null) {
32+
if (provider.state.index == 0) {
33+
provider.state.controller?.loadUrl(
34+
urlRequest: URLRequest(url: WebUri(url.toString())),
35+
);
36+
} else {
37+
provider.state.controller?.loadUrl(
38+
urlRequest: URLRequest(
39+
url: WebUri(
40+
provider.state.links[selectedIndex]['url'].toString(),
41+
),
42+
),
43+
);
44+
}
45+
}
46+
},
47+
)
48+
: null;
49+
}

lib/Widget/custom_app_bar.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// ignore_for_file: must_be_immutable
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutterx/widget_parser/entry_widget_parser.dart';
5+
6+
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
7+
CustomAppBar({super.key, required this.payload});
8+
String payload;
9+
@override
10+
Widget build(BuildContext context) {
11+
try {
12+
return WidgetParserBuilder.build(
13+
payload,
14+
context,
15+
DefaultClickListener(),
16+
)!;
17+
} catch (e) {
18+
debugPrint("Error parsing JSON payload: $e");
19+
return AppBar(title: const Text("Error Parsing AppBar"));
20+
}
21+
}
22+
23+
@override
24+
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
25+
}
26+
27+
class DefaultClickListener implements ClickListener {
28+
@override
29+
void onClicked(String? event) {
30+
debugPrint("Receive click event: ${event ?? ""}");
31+
}
32+
}

lib/Widget/error_widget.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:flutter/material.dart';
2+
3+
class CustomErrorWidget extends StatelessWidget {
4+
const CustomErrorWidget({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
return Center(
9+
child: Column(
10+
mainAxisAlignment: MainAxisAlignment.center,
11+
children: [
12+
const Text(
13+
'Error loading page. Please check your internet connection.'),
14+
ElevatedButton(
15+
onPressed: () {
16+
// setState(() {
17+
// isPageLoadError = false;
18+
// isLoading = true;
19+
// });
20+
// _controller.reload();
21+
},
22+
child: const Text('Retry'),
23+
),
24+
],
25+
),
26+
);
27+
}
28+
}

0 commit comments

Comments
 (0)