command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"test", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '12.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | target.build_configurations.each do |config|
41 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
42 | end
43 | end
44 | end
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DELIVERY
2 |
3 | A Flutter project for delivery restaurants/fast food. `Null safety`
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | ## Requirements
14 | - flutter 2.10+
15 |
16 | ## Getting Started
17 |
18 | clone this repo and run `flutter pub get` to install all the dependencies
19 |
20 | follow the instructions for the **Firebase** package [here](https://firebase.flutter.dev/docs/overview/)
21 |
22 | if you don't need Firebase messaging just comment the initialize inside **main.dart**
23 |
24 | This project is a Flutter application.
25 | A few resources to get you started if this is your first Flutter project:
26 |
27 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
28 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
29 |
30 | For help getting started with Flutter, view our
31 | [online documentation](https://flutter.dev/docs), which offers tutorials,
32 | samples, guidance on mobile development, and a full API reference.
33 |
--------------------------------------------------------------------------------
/lib/Library/Animation/FadeAnimation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:simple_animations/simple_animations.dart';
3 |
4 | class FadeAnimation extends StatelessWidget {
5 | final double delay;
6 | final Widget child;
7 |
8 | FadeAnimation(
9 | this.delay,
10 | this.child,
11 | );
12 | @override
13 | Widget build(BuildContext context) {
14 | //final tween = MultiTween([
15 | // Track("opacity")
16 | // .add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)),
17 | // Track("translateY").add(
18 | // Duration(milliseconds: 1500), Tween(begin: -30.0, end: 0.0),
19 | // curve: Curves.easeOut)
20 | //]);
21 | // final tween = MultiTween(
22 | // // [
23 | // // Track("opacity").add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)),
24 | // // Track("translateY").add(
25 | // // Duration(milliseconds: 500), Tween(begin: -30.0, end: 0.0),
26 | // // curve: Curves.easeOut)
27 | // // ]
28 | //
29 | // )
30 | // ..add(
31 | // AniProps.opacity,
32 | // Tween(begin: 0.0, end: 1.0),
33 | // const Duration(milliseconds: 300),
34 | // )
35 | // ..add(AniProps.translateY, Tween(begin: -30.0, end: 0.0),
36 | // const Duration(milliseconds: 500), Curves.easeOut);
37 | final tween = Tween(begin: 0, end: 1);
38 |
39 | return PlayAnimation(
40 | delay: Duration(milliseconds: (900 * delay).round()),
41 | // duration: tween.duration,
42 | tween: tween,
43 | child: child,
44 | builder: (context, child, animation) => const Opacity(
45 | opacity: 1.0,
46 | ),
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib/Library/overlay.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:food_template/Library/loader.dart';
3 |
4 | class OverlayView extends StatelessWidget {
5 | const OverlayView({
6 | Key? key,
7 | }) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return yourOverLayWidget();
12 | }
13 |
14 | Container yourOverLayWidget() {
15 | return Container(
16 | color: Colors.black.withOpacity(0.5),
17 | child: Padding(
18 | padding: const EdgeInsets.all(8.0),
19 | child: Center(
20 | child: Row(
21 | children: [
22 | Expanded(
23 | child: Card(
24 | child: Column(
25 | mainAxisSize: MainAxisSize.min,
26 | children: [
27 | Row(
28 | children: [
29 | const Spacer(),
30 | IconButton(
31 | icon: const Icon(Icons.close_outlined),
32 | onPressed: () {
33 | Loader.appLoader.hideLoader();
34 | },
35 | ),
36 | ],
37 | ),
38 | const Icon(
39 | Icons.error_rounded,
40 | color: Colors.red,
41 | size: 50,
42 | ),
43 | const SizedBox(
44 | height: 16,
45 | ),
46 | ],
47 | ),
48 | ),
49 | ),
50 | ],
51 | ),
52 | ),
53 | ),
54 | );
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/Library/intro_views_flutter-2.4.0/lib/Models/page_view_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //view model for pages
4 |
5 | class PageViewModel {
6 | /// Page BackGround Color
7 | final Color pageColor;
8 |
9 | ///icon image path
10 | final String iconImageAssetPath;
11 |
12 | /// iconColor
13 | final Color iconColor;
14 |
15 | /// color for background of progress bubbles
16 | ///
17 | /// @Default `const Color(0x88FFFFFF)`
18 | final Color bubbleBackgroundColor;
19 |
20 | /// widget for the title
21 | ///
22 | /// _typicaly a Text Widget_
23 | ///
24 | /// @Default Textstyle `color: Colors.white , fontSize: 50.0`
25 | final Widget title;
26 |
27 | /// widget for the body
28 | ///
29 | /// _typicaly a Text Widget_
30 | ///
31 | /// @Default Textstyle `color: Colors.white, fontSize: 24.0`
32 | final Widget body;
33 |
34 | /// set default TextStyle for both title and body
35 | final TextStyle textStyle;
36 |
37 | /// Image Widget
38 | ///
39 | /// _typicaly a Image Widget_
40 | final Widget mainImage;
41 |
42 | /// bubble inner Widget
43 | ///
44 | /// _typicaly a Image Widget_
45 | ///
46 | /// gets overriden by [iconImageAssetPath]
47 | final Widget bubble;
48 |
49 | PageViewModel({
50 | required this.pageColor,
51 | required this.iconImageAssetPath,
52 | this.bubbleBackgroundColor = const Color(0x88FFFFFF),
53 | required this.iconColor,
54 | required this.title,
55 | required this.body,
56 | required this.mainImage,
57 | required this.bubble,
58 | required this.textStyle,
59 | });
60 |
61 | TextStyle get titleTextStyle {
62 | return TextStyle(color: Colors.white, fontSize: 50.0).merge(this.textStyle);
63 | }
64 |
65 | TextStyle get bodyTextStyle {
66 | return TextStyle(color: Colors.white, fontSize: 24.0).merge(this.textStyle);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/Screen/widgets/loading_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoadingButton extends StatefulWidget {
4 | final Future Function()? onPressed;
5 | final String text;
6 |
7 | const LoadingButton({Key? key, required this.onPressed, required this.text})
8 | : super(key: key);
9 |
10 | @override
11 | _LoadingButtonState createState() => _LoadingButtonState();
12 | }
13 |
14 | class _LoadingButtonState extends State {
15 | bool _isLoading = false;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return Row(
20 | mainAxisSize: MainAxisSize.max,
21 | children: [
22 | Expanded(
23 | child: ElevatedButton(
24 | style: ElevatedButton.styleFrom(
25 | primary: Colors.amber.shade700,
26 | padding: const EdgeInsets.symmetric(vertical: 12),
27 | shape: RoundedRectangleBorder(
28 | borderRadius: BorderRadius.circular(30.0),
29 | ),
30 | ),
31 | onPressed:
32 | (_isLoading || widget.onPressed == null) ? null : _loadFuture,
33 | child: _isLoading
34 | ? const SizedBox(
35 | height: 22,
36 | width: 22,
37 | child: CircularProgressIndicator(
38 | strokeWidth: 2,
39 | ),
40 | )
41 | : Text(widget.text),
42 | ),
43 | ),
44 | ],
45 | );
46 | }
47 |
48 | Future _loadFuture() async {
49 | setState(() {
50 | _isLoading = true;
51 | });
52 |
53 | try {
54 | await widget.onPressed!();
55 | } catch (e, s) {
56 | //print(e);
57 | rethrow;
58 | } finally {
59 | setState(() {
60 | _isLoading = false;
61 | });
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Wholedata
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | test
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UIBackgroundModes
28 |
29 | fetch
30 | processing
31 | remote-notification
32 |
33 | UILaunchStoryboardName
34 | LaunchScreen
35 | UIMainStoryboardFile
36 | Main
37 | UIStatusBarHidden
38 |
39 | UISupportedInterfaceOrientations
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | UISupportedInterfaceOrientations~ipad
46 |
47 | UIInterfaceOrientationPortrait
48 | UIInterfaceOrientationPortraitUpsideDown
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
--------------------------------------------------------------------------------
/lib/Library/no_connection.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import '/Screen/Bottom_Nav_Bar/Bottom_Navigation_Bar.dart';
3 |
4 | class NoConnection extends StatelessWidget {
5 | const NoConnection({Key? key}) : super(key: key);
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | backgroundColor: Colors.black87,
11 | body: Column(
12 | mainAxisAlignment: MainAxisAlignment.center,
13 | children: [
14 | const Text(
15 | 'Opppsss! \nqualcosa è andato storto',
16 | textAlign: TextAlign.center,
17 | style: TextStyle(
18 | fontFamily: "Sofia",
19 | fontSize: 16,
20 | color: Colors.white,
21 | fontWeight: FontWeight.w600,
22 | ),
23 | ),
24 | const SizedBox(
25 | height: 20,
26 | ),
27 | Image.asset('assets/image/no_connection.png'),
28 | const Text(
29 | 'Opppsss! \nqualcosa è andato storto',
30 | textAlign: TextAlign.center,
31 | style: TextStyle(
32 | fontFamily: "Sofia",
33 | fontSize: 16,
34 | color: Colors.white,
35 | fontWeight: FontWeight.w600,
36 | ),
37 | ),
38 | const SizedBox(
39 | height: 20,
40 | ),
41 | ElevatedButton(
42 | onPressed: () {
43 | Navigator.of(context).pushReplacement(
44 | PageRouteBuilder(
45 | pageBuilder: (_, __, ____) => BottomNavigationBarT2()),
46 | );
47 | },
48 | child: const Text(
49 | 'Riprova',
50 | textAlign: TextAlign.center,
51 | style: TextStyle(
52 | fontFamily: "Sofia",
53 | fontSize: 16,
54 | color: Colors.white,
55 | fontWeight: FontWeight.w600,
56 | ),
57 | ),
58 | )
59 | ],
60 | ),
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/lib/firebase_options.dart:
--------------------------------------------------------------------------------
1 | // File generated by FlutterFire CLI.
2 | // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
3 | import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
4 | import 'package:flutter/foundation.dart'
5 | show defaultTargetPlatform, kIsWeb, TargetPlatform;
6 |
7 | /// Default [FirebaseOptions] for use with your Firebase apps.
8 | ///
9 | /// Example:
10 | /// ```dart
11 | /// import 'firebase_options.dart';
12 | /// // ...
13 | /// await Firebase.initializeApp(
14 | /// options: DefaultFirebaseOptions.currentPlatform,
15 | /// );
16 | /// ```
17 | class DefaultFirebaseOptions {
18 | static FirebaseOptions get currentPlatform {
19 | switch (defaultTargetPlatform) {
20 | case TargetPlatform.android:
21 | return android;
22 | case TargetPlatform.iOS:
23 | return ios;
24 | case TargetPlatform.macOS:
25 | throw UnsupportedError(
26 | 'DefaultFirebaseOptions have not been configured for macos - '
27 | 'you can reconfigure this by running the FlutterFire CLI again.',
28 | );
29 | case TargetPlatform.windows:
30 | throw UnsupportedError(
31 | 'DefaultFirebaseOptions have not been configured for windows - '
32 | 'you can reconfigure this by running the FlutterFire CLI again.',
33 | );
34 | case TargetPlatform.linux:
35 | throw UnsupportedError(
36 | 'DefaultFirebaseOptions have not been configured for linux - '
37 | 'you can reconfigure this by running the FlutterFire CLI again.',
38 | );
39 | default:
40 | throw UnsupportedError(
41 | 'DefaultFirebaseOptions are not supported for this platform.',
42 | );
43 | }
44 | }
45 |
46 | static const FirebaseOptions android = FirebaseOptions(
47 | apiKey: '',
48 | appId: '',
49 | messagingSenderId: '',
50 | projectId: '',
51 | storageBucket: '',
52 | );
53 |
54 | static const FirebaseOptions ios = FirebaseOptions(
55 | apiKey: '',
56 | appId: '',
57 | messagingSenderId: '',
58 | projectId: '',
59 | storageBucket: '',
60 | iosClientId: '',
61 | iosBundleId: '',
62 | );
63 | }
64 |
--------------------------------------------------------------------------------
/lib/Library/intro_views_flutter-2.4.0/lib/UI/page_bubble.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:food_template/Library/intro_views_flutter-2.4.0/lib/Models/page_bubble_view_model.dart';
5 |
6 | /// This class contains the UI for page bubble.
7 | class PageBubble extends StatelessWidget {
8 | //view model
9 | final PageBubbleViewModel viewModel;
10 |
11 | //Constructor
12 | PageBubble({
13 | required this.viewModel,
14 | });
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return new Container(
19 | width: 55.0,
20 | height: 65.0,
21 | decoration:
22 | BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10.0))),
23 | child: new Center(
24 | child: new Padding(
25 | padding: const EdgeInsets.all(0.5),
26 | child: new Container(
27 | width:
28 | 60.0, //This method return in between values according to active percent.
29 | height: 4.0,
30 | decoration: new BoxDecoration(
31 | borderRadius: BorderRadius.all(Radius.circular(0.0)),
32 | //Alpha is used to create fade effect for background color
33 | color: viewModel.isHollow ? Colors.white24 : Color(0xFFF88421),
34 | border: new Border.all(
35 | color: viewModel.isHollow
36 | ? viewModel.bubbleBackgroundColor!.withAlpha(
37 | (0xFF * (0.1 - viewModel.activePercent)).round())
38 | : Colors.white10,
39 | width: 2.0,
40 | ), //Border
41 | ), //BoxDecoration
42 | child: new Opacity(
43 | opacity: viewModel.activePercent,
44 | child: (viewModel.iconAssetPath != null &&
45 | viewModel.iconAssetPath != "")
46 | // ignore: conflicting_dart_import
47 | ? new Image.asset(
48 | viewModel.iconAssetPath,
49 | color: viewModel.iconColor,
50 | )
51 | : new Container(),
52 | ), //opacity
53 | ), //Container
54 | ), //Padding
55 | ), //Center
56 | ); //Container
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.google.gms.google-services'
25 | apply plugin: 'com.android.application'
26 | apply plugin: 'kotlin-android'
27 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
28 |
29 | android {
30 | compileSdkVersion flutter.compileSdkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "io.wholedata.test"
48 | minSdkVersion localProperties.getProperty('flutter.minSdkVersion')
49 | targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion')
50 | versionCode flutterVersionCode.toInteger()
51 | versionName flutterVersionName
52 | multiDexEnabled true
53 | }
54 |
55 | buildTypes {
56 | release {
57 | // TODO: Add your own signing config for the release build.
58 | // Signing with the debug keys for now, so `flutter run --release` works.
59 | signingConfig signingConfigs.debug
60 | }
61 | }
62 | }
63 |
64 | flutter {
65 | source '../..'
66 | }
67 |
68 | dependencies {
69 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
70 | implementation platform('com.google.firebase:firebase-bom:29.2.1')
71 | implementation 'com.android.support:multidex:1.0.3'
72 | implementation 'com.google.firebase:firebase-analytics-ktx'
73 | }
74 |
--------------------------------------------------------------------------------
/lib/Library/loading_button.dart:
--------------------------------------------------------------------------------
1 | import 'dart:developer';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | class LoadingButton extends StatefulWidget {
6 | final Future Function()? onPressed;
7 | final String text;
8 |
9 | const LoadingButton({Key? key, required this.onPressed, required this.text})
10 | : super(key: key);
11 |
12 | @override
13 | _LoadingButtonState createState() => _LoadingButtonState();
14 | }
15 |
16 | class _LoadingButtonState extends State {
17 | bool _isLoading = false;
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | return Row(
22 | mainAxisSize: MainAxisSize.max,
23 | crossAxisAlignment: CrossAxisAlignment.center,
24 | mainAxisAlignment: MainAxisAlignment.center,
25 | children: [
26 | ElevatedButton(
27 | style: ElevatedButton.styleFrom(
28 | primary: Colors.orangeAccent,
29 | padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
30 | shape: RoundedRectangleBorder(
31 | borderRadius: BorderRadius.circular(30.0),
32 | ),
33 | // minimumSize: const Size(330, 60),
34 | ),
35 | onPressed: () {
36 | print('PAY');
37 | print(_isLoading);
38 | print(widget.onPressed);
39 | if (_isLoading == null || widget.onPressed == null) {
40 | return null;
41 | } else {
42 | _loadFuture;
43 | }
44 | },
45 | child: _isLoading
46 | ? const SizedBox(
47 | height: 22,
48 | width: 22,
49 | child: CircularProgressIndicator(
50 | strokeWidth: 2,
51 | ))
52 | : Text(
53 | widget.text,
54 | style: const TextStyle(
55 | color: Colors.white,
56 | fontSize: 17.0,
57 | fontWeight: FontWeight.w700,
58 | fontFamily: "Sofia",
59 | letterSpacing: 0.9),
60 | ),
61 | ),
62 | ],
63 | );
64 | }
65 |
66 | Future _loadFuture() async {
67 | setState(() {
68 | _isLoading = true;
69 | });
70 |
71 | try {
72 | await widget.onPressed!();
73 | } catch (e, s) {
74 | log(e.toString(), error: e, stackTrace: s);
75 | ScaffoldMessenger.of(context)
76 | .showSnackBar(SnackBar(content: Text('Error $e')));
77 | rethrow;
78 | } finally {
79 | setState(() {
80 | _isLoading = false;
81 | });
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/lib/models/menuModel.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:convert';
3 | import 'dart:io';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:http/http.dart' as http;
6 | import 'package:food_template/constants.dart';
7 | //import 'package:flutter/services.dart' show rootBundle;
8 |
9 | Future> fetchMenus(http.Client client) async {
10 | final queryParameters = {
11 | 'restaurant_pk': RESTAURANT_PK,
12 | };
13 | //final httpUri = Uri(
14 | // scheme: 'https',
15 | // host: 'wholedata.io',
16 | // path: '/api/menu/',
17 | // queryParameters: {'restaurant_pk': RESTAURANT_PK});
18 | final uri = Uri.https(BASE_URL, 'api/menu', queryParameters);
19 | final response = await client.get(uri, headers: {
20 | HttpHeaders.contentTypeHeader: 'application/json',
21 | });
22 |
23 | //final response = await rootBundle.loadString('assets/data/menu.json');
24 |
25 | // Use the compute function to run parseMenus in a separate isolate.
26 | return compute(parseMenus, response.body);
27 | }
28 |
29 | Future