├── linux
├── .gitignore
├── main.cc
├── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ ├── generated_plugins.cmake
│ └── CMakeLists.txt
├── my_application.h
└── my_application.cc
├── lib
├── ui
│ ├── shared
│ │ ├── bottomsheets
│ │ │ ├── _bottomsheets.dart
│ │ │ └── create_order_sheet
│ │ │ │ └── create_order_sheet_viewmodel.dart
│ │ ├── _shared.dart
│ │ ├── constants
│ │ │ ├── _constants.dart
│ │ │ ├── app_constants.dart
│ │ │ ├── app_assets.dart
│ │ │ ├── app_colors.dart
│ │ │ ├── app_textstyles.dart
│ │ │ ├── spacing.dart
│ │ │ └── app_theme.dart
│ │ └── components
│ │ │ ├── _components.dart
│ │ │ └── general
│ │ │ ├── app_loader.dart
│ │ │ ├── section_item.dart
│ │ │ ├── scrollable_column.dart
│ │ │ └── app_button.dart
│ └── views
│ │ └── home_view
│ │ ├── widgets
│ │ ├── pop_menu.dart
│ │ ├── orders_section.dart
│ │ ├── ticker_section.dart
│ │ └── rates_section.dart
│ │ ├── home_viewmodel.dart
│ │ └── home_view.dart
├── services
│ ├── api_services
│ │ ├── _api_services.dart
│ │ └── binance_service
│ │ │ ├── i_binance_service.dart
│ │ │ └── binance_service.dart
│ └── core_services
│ │ ├── _core_services.dart
│ │ ├── network_service
│ │ ├── i_network_service.dart
│ │ └── network_service.dart
│ │ └── websocket_service
│ │ ├── i_websocket_service.dart
│ │ └── websocket_service.dart
├── core
│ ├── utilities
│ │ └── id_utils.dart
│ ├── enums
│ │ ├── main_view_enum.dart
│ │ ├── orders_view_enum.dart
│ │ └── chart_interval_enum.dart
│ ├── app
│ │ ├── _app.dart
│ │ ├── app.bottomsheets.dart
│ │ ├── app.dart
│ │ ├── app.locator.dart
│ │ ├── app.router.dart
│ │ └── app.logger.dart
│ ├── _core.dart
│ ├── interceptors
│ │ └── logger_interceptor.dart
│ └── extensions
│ │ └── context_extenstion.dart
├── models
│ ├── _models.dart
│ ├── orderbook_data.dart
│ ├── symbol_data.dart
│ ├── failure.dart
│ ├── candle_data.dart
│ └── ticker_data.dart
└── main.dart
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── README.md
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
├── RunnerTests
│ └── RunnerTests.swift
└── .gitignore
├── macos
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Runner
│ ├── Configs
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ ├── Warnings.xcconfig
│ │ └── AppInfo.xcconfig
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ ├── app_icon_64.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Release.entitlements
│ ├── DebugProfile.entitlements
│ ├── MainFlutterWindow.swift
│ └── Info.plist
├── .gitignore
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
└── RunnerTests
│ └── RunnerTests.swift
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── manifest.json
└── index.html
├── android
├── gradle.properties
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── values-night
│ │ │ │ │ └── styles.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── dao_preview
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── .gitignore
├── build.gradle
└── settings.gradle
├── assets
├── images
│ └── profile_image.png
└── svgs
│ ├── arrangement1.svg
│ ├── arrangement2.svg
│ ├── arrangement3.svg
│ ├── menu.svg
│ ├── globe.svg
│ ├── expand.svg
│ ├── candle_chart.svg
│ └── btc_usdt.svg
├── windows
├── runner
│ ├── resources
│ │ └── app_icon.ico
│ ├── resource.h
│ ├── utils.h
│ ├── runner.exe.manifest
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── CMakeLists.txt
│ ├── utils.cpp
│ ├── flutter_window.cpp
│ ├── Runner.rc
│ └── win32_window.h
├── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ ├── generated_plugins.cmake
│ └── CMakeLists.txt
├── .gitignore
└── CMakeLists.txt
├── .gitignore
├── README.md
├── analysis_options.yaml
├── .metadata
├── test
├── services
│ └── api_services
│ │ └── binance_service_test.dart
└── helpers
│ └── service_helpers.dart
└── pubspec.yaml
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/lib/ui/shared/bottomsheets/_bottomsheets.dart:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/web/favicon.png
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4G
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/assets/images/profile_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/assets/images/profile_image.png
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/lib/services/api_services/_api_services.dart:
--------------------------------------------------------------------------------
1 | export 'binance_service/binance_service.dart';
2 | export 'binance_service/i_binance_service.dart';
3 |
--------------------------------------------------------------------------------
/lib/ui/shared/_shared.dart:
--------------------------------------------------------------------------------
1 | export 'bottomsheets/_bottomsheets.dart';
2 | export 'components/_components.dart';
3 | export 'constants/_constants.dart';
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/lib/core/utilities/id_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:uuid/uuid.dart';
2 |
3 | class IdUtils {
4 | static String generateId() {
5 | return const Uuid().v4();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/lib/models/_models.dart:
--------------------------------------------------------------------------------
1 | export 'candle_data.dart';
2 | export 'failure.dart';
3 | export 'orderbook_data.dart';
4 | export 'symbol_data.dart';
5 | export 'ticker_data.dart';
6 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lord-Chris/DEX_Preview/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/dao_preview/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.dao_preview
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity()
6 |
--------------------------------------------------------------------------------
/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/_constants.dart:
--------------------------------------------------------------------------------
1 | export 'app_assets.dart';
2 | export 'app_colors.dart';
3 | export 'app_constants.dart';
4 | export 'app_textstyles.dart';
5 | export 'app_theme.dart';
6 | export 'spacing.dart';
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/core/enums/main_view_enum.dart:
--------------------------------------------------------------------------------
1 | enum MainViewEnum {
2 | charts('Charts'),
3 | orderbook('Orderbook'),
4 | recentTrades('Recent trades');
5 |
6 | final String value;
7 | const MainViewEnum(this.value);
8 | }
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/core/app/_app.dart:
--------------------------------------------------------------------------------
1 | export 'package:stacked_services/stacked_services.dart';
2 |
3 | export 'app.bottomsheets.dart';
4 | export 'app.dart';
5 | export 'app.locator.dart';
6 | export 'app.logger.dart';
7 | export 'app.router.dart';
8 |
--------------------------------------------------------------------------------
/lib/core/enums/orders_view_enum.dart:
--------------------------------------------------------------------------------
1 | enum OrdersViewEnum {
2 | openOrders('Open Orders'),
3 | positions('Positions'),
4 | orderHistory('Order History');
5 |
6 | final String value;
7 | const OrdersViewEnum(this.value);
8 | }
9 |
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
6 |
--------------------------------------------------------------------------------
/lib/services/core_services/_core_services.dart:
--------------------------------------------------------------------------------
1 | export 'network_service/i_network_service.dart';
2 | export 'network_service/network_service.dart';
3 |
4 | ///
5 | export 'websocket_service/i_websocket_service.dart';
6 | export 'websocket_service/websocket_service.dart';
7 |
--------------------------------------------------------------------------------
/lib/ui/shared/components/_components.dart:
--------------------------------------------------------------------------------
1 | export 'general/app_button.dart';
2 | export 'general/app_loader.dart';
3 | export 'general/app_network_image.dart';
4 | export 'general/app_textfield.dart';
5 | export 'general/scrollable_column.dart';
6 | export 'general/section_item.dart';
7 |
--------------------------------------------------------------------------------
/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/assets/svgs/arrangement1.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/assets/svgs/arrangement2.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/assets/svgs/arrangement3.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/core/_core.dart:
--------------------------------------------------------------------------------
1 | export 'enums/chart_interval_enum.dart';
2 | export 'enums/main_view_enum.dart';
3 | export 'enums/orders_view_enum.dart';
4 |
5 | ///
6 | export 'extensions/context_extenstion.dart';
7 |
8 | ///
9 | export 'interceptors/logger_interceptor.dart';
10 |
11 | ///
12 | export 'utilities/id_utils.dart';
13 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import FlutterMacOS
2 | import Cocoa
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = '../build'
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(':app')
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/app_constants.dart:
--------------------------------------------------------------------------------
1 | class AppConstants {
2 | static const appName = 'Rayda Track';
3 | static const mockImage =
4 | 'https://www.bing.com/th?id=OIP.Sa9ZfKEPzreh38i8xrwQJgHaEo&w=316&h=197&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2';
5 | static const mockTestsImage =
6 | 'https://valhala-stg.s3.eu-west-2.amazonaws.com/avatar/woman-graduating-with-certificate-avatar-character-vector-25010708.jpg';
7 | }
8 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/core/enums/chart_interval_enum.dart:
--------------------------------------------------------------------------------
1 | enum ChartIntervalEnum {
2 | oneSecond('1s', '1s'),
3 | oneMinute('1m', '1m'),
4 | fifteenMinutes('15m', '15m'),
5 | oneHour('1H', '1h'),
6 | twoHours('2H', '2h'),
7 | fourHours('4H', '4h'),
8 | oneDay('1D', '1d'),
9 | oneWeek('1W', '1w'),
10 | oneMonth('1M', '1M');
11 |
12 | final String name;
13 | final String value;
14 |
15 | const ChartIntervalEnum(this.name, this.value);
16 | }
17 |
--------------------------------------------------------------------------------
/lib/ui/shared/bottomsheets/create_order_sheet/create_order_sheet_viewmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:stacked/stacked.dart';
2 |
3 | class CreateOrderSheetViewModel extends BaseViewModel {
4 | String orderType = 'Buy';
5 | String type = 'Limit';
6 |
7 | void setOrdertype(String value) {
8 | orderType = value;
9 | notifyListeners();
10 | }
11 |
12 | void setType(String type) {
13 | this.type = type;
14 | notifyListeners();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/services/api_services/binance_service/i_binance_service.dart:
--------------------------------------------------------------------------------
1 | import '../../../models/_models.dart';
2 |
3 | /// Interface for the Binance service.
4 | abstract class IBinanceService {
5 | /// Fetches a list of candle data for a specific symbol and interval.
6 | ///
7 | /// - [symbol]: The symbol for which to fetch the candle data.
8 | /// - [interval]: The interval for the candle data (e.g., "1m", "1h", "1d").
9 | ///
10 | /// Returns a [Future] that resolves to a list of [CandleData].
11 | Future> fetchCandles(String symbol, String interval);
12 | }
13 |
--------------------------------------------------------------------------------
/lib/services/core_services/network_service/i_network_service.dart:
--------------------------------------------------------------------------------
1 | abstract class INetworkService {
2 | Future get(
3 | String url, {
4 | Map? headers,
5 | });
6 |
7 | Future post(
8 | String url, {
9 | dynamic body,
10 | Map? headers,
11 | });
12 |
13 | Future put(
14 | String url, {
15 | dynamic body,
16 | Map? headers,
17 | });
18 |
19 | Future delete(
20 | String url, {
21 | dynamic body,
22 | Map? headers,
23 | });
24 | }
25 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = dao_preview
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.daoPreview
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'core/app/_app.dart';
4 | import 'ui/shared/_shared.dart';
5 |
6 | void main() {
7 | setupLocator();
8 | setupBottomSheetUi();
9 | runApp(const MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | const MyApp({super.key});
14 |
15 | // This widget is the root of your application.
16 | @override
17 | Widget build(BuildContext context) {
18 | return MaterialApp(
19 | title: AppConstants.appName,
20 | theme: AppTheme.lightTheme,
21 | darkTheme: AppTheme.darkTheme,
22 | themeMode: ThemeMode.system,
23 | navigatorKey: StackedService.navigatorKey,
24 | onGenerateRoute: StackedRouter().onGenerateRoute,
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/assets/svgs/menu.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
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 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Symbolication related
35 | app.*.symbols
36 |
37 | # Obfuscation related
38 | app.*.map.json
39 |
40 | # Android Studio will place build artifacts here
41 | /android/app/debug
42 | /android/app/profile
43 | /android/app/release
44 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/core/app/app.bottomsheets.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // StackedBottomsheetGenerator
5 | // **************************************************************************
6 |
7 | import 'package:stacked_services/stacked_services.dart';
8 |
9 | import 'app.locator.dart';
10 | import '../../ui/shared/bottomsheets/create_order_sheet/create_order_sheet.dart';
11 |
12 | enum BottomSheetType {
13 | createOrder,
14 | }
15 |
16 | void setupBottomSheetUi() {
17 | final bottomsheetService = locator();
18 |
19 | final Map builders = {
20 | BottomSheetType.createOrder: (context, request, completer) =>
21 | CreateOrderSheet(request: request, completer: completer),
22 | };
23 |
24 | bottomsheetService.setCustomSheetBuilders(builders);
25 | }
26 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | repositories {
14 | google()
15 | mavenCentral()
16 | gradlePluginPortal()
17 | }
18 | }
19 |
20 | plugins {
21 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22 | id "com.android.application" version "7.3.0" apply false
23 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false
24 | }
25 |
26 | include ":app"
27 |
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/lib/services/core_services/websocket_service/i_websocket_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import '../../../models/_models.dart';
4 |
5 | /// An interface for a WebSocket service.
6 | abstract class IWebSocketService {
7 | /// Initializes the WebSocket service.
8 | Future init();
9 |
10 | /// Subscribes to a symbol with the specified interval and depth.
11 | ///
12 | /// Returns the subscription ID.
13 | String subscribeToSymbol(String symbol, String interval, String depth);
14 |
15 | /// Unsubscribes from a symbol with the specified interval and depth.
16 | void unsubscribeFromSymbol(String symbol, String interval, String depth);
17 |
18 | /// Disposes the WebSocket service.
19 | Future dispose();
20 |
21 | /// A stream of ticker data.
22 | Stream get tickerDataStream;
23 |
24 | /// A stream of candle data.
25 | Stream> get candleDataStream;
26 |
27 | /// A stream of orderbook data.
28 | Stream get orderbookDataStream;
29 | }
30 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/app_assets.dart:
--------------------------------------------------------------------------------
1 | class AppSvgAssets {
2 | AppSvgAssets._();
3 |
4 | static const _prefix = 'assets/svgs';
5 |
6 | static const btcUsdt = '$_prefix/btc_usdt.svg';
7 | static const companyLogoDark = '$_prefix/company_logo_dark.svg';
8 | static const companyLogoLight = '$_prefix/company_logo_light.svg';
9 | static String companyLogo(String brightness) =>
10 | '$_prefix/company_logo_$brightness.svg';
11 | static const expand = '$_prefix/expand.svg';
12 | static const globe = '$_prefix/globe.svg';
13 | static const menu = '$_prefix/menu.svg';
14 | static const arrangement1 = '$_prefix/arrangement1.svg';
15 | static const arrangement2 = '$_prefix/arrangement2.svg';
16 | static const arrangement3 = '$_prefix/arrangement3.svg';
17 | static const candleChart = '$_prefix/candle_chart.svg';
18 | }
19 |
20 | class AppImgAssets {
21 | AppImgAssets._();
22 |
23 | static const _prefix = 'assets/images';
24 |
25 | static const profileImage = '$_prefix/profile_image.png';
26 | }
27 |
--------------------------------------------------------------------------------
/lib/ui/shared/components/general/app_loader.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class AppLoader extends StatelessWidget {
8 | final Color? color;
9 | final double? padding;
10 | final double? size;
11 | const AppLoader({
12 | super.key,
13 | this.color,
14 | this.padding,
15 | this.size = 25,
16 | });
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | return Center(
21 | child: Padding(
22 | padding: EdgeInsets.all(padding ?? 5),
23 | child: SizedBox(
24 | height: size,
25 | width: size,
26 | child: kIsWeb
27 | ? CircularProgressIndicator(color: color)
28 | : Platform.isAndroid
29 | ? CircularProgressIndicator(color: color)
30 | : CupertinoActivityIndicator(color: color, radius: 13),
31 | ),
32 | ),
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dao_preview",
3 | "short_name": "dao_preview",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DEX Preview
2 | DEX Preview is a mobile app that allows users to preview the latest digital assets on the DEX platform. Users can view the latest digital assets, search for specific assets, and view detailed information about each asset.
3 |
4 | ## Features
5 | - View BTCUSDT ticker information.
6 | - Interactive klines chart for BTCUSDT.
7 | - Interactive orderbook for BTCUSDT.
8 | - Light and dark Theme modes
9 | - Responsive UI
10 |
11 | ## Mobile App
12 | The DEX Preview mobile app is built using the following technologies:
13 |
14 | - [Flutter](https://flutter.dev/), a cross-platform mobile development framework by Google.
15 | - [Binance WebSocket API] (https://binance-docs.github.io/apidocs/spot/en) for realtime data.
16 | - State Managment - Stacked Architecture[Provider].
17 |
18 |
19 | **DEX Preview can be previewed on iOS and Android.*
20 |
21 | ## Video Demo
22 |
23 | https://github.com/Lord-Chris/DEX_Preview/assets/58702861/c5bd4b53-8b72-4691-82d6-5b5d51b3a6d7
24 |
25 | High Quality Video Link: https://drive.google.com/file/d/1nIj6kiwUzfx6243YwGiOHjls6OJ4WOmU/view?usp=sharing
26 |
27 |
28 |
--------------------------------------------------------------------------------
/assets/svgs/globe.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/lib/core/app/app.dart:
--------------------------------------------------------------------------------
1 | import 'package:stacked/stacked_annotations.dart';
2 | import 'package:stacked_services/stacked_services.dart';
3 |
4 | import '../../services/api_services/_api_services.dart';
5 | import '../../services/core_services/_core_services.dart';
6 | import '../../ui/shared/bottomsheets/create_order_sheet/create_order_sheet.dart';
7 | import '../../ui/views/home_view/home_view.dart';
8 |
9 | /// Run "flutter pub run build_runner build --delete-conflicting-outputs"
10 | /// Run "flutter pub run build_runner watch --delete-conflicting-outputs"
11 | @StackedApp(
12 | routes: [
13 | /// Startup
14 | AdaptiveRoute(page: HomeView, initial: true),
15 | ],
16 | logger: StackedLogger(),
17 | dependencies: [
18 | LazySingleton(classType: NavigationService),
19 | LazySingleton(classType: BottomSheetService),
20 |
21 | /// Core Services
22 | LazySingleton(classType: WebSocketService, asType: IWebSocketService),
23 | LazySingleton(classType: NetworkService, asType: INetworkService),
24 | // LazySingleton(classType: WebSocketService, asType: IWebSocketService),
25 |
26 | /// API Services
27 | LazySingleton(classType: BinanceService, asType: IBinanceService),
28 | ],
29 | bottomsheets: [
30 | StackedBottomsheet(classType: CreateOrderSheet),
31 | ],
32 | )
33 | class App {}
34 |
--------------------------------------------------------------------------------
/lib/services/api_services/binance_service/binance_service.dart:
--------------------------------------------------------------------------------
1 | import '../../../core/app/_app.dart';
2 | import '../../../models/_models.dart';
3 | import '../../core_services/_core_services.dart';
4 | import 'i_binance_service.dart';
5 |
6 | /// A service class that interacts with the Binance API to fetch symbol and candle data.
7 | class BinanceService extends IBinanceService {
8 | /// The base URL for the Binance API.
9 | static const _baseUrl = 'https://api.binance.com/api/v3';
10 | final _networkService = locator();
11 |
12 | /// Fetches a list of candle data for a specific symbol and interval from the Binance API.
13 | ///
14 | /// - [symbol]: The symbol for which to fetch the candle data.
15 | /// - [interval]: The interval of the candle data (e.g., '1m', '1h', '1d').
16 | ///
17 | /// Returns a list of [CandleData] objects.
18 | @override
19 | Future> fetchCandles(String symbol, String interval) async {
20 | try {
21 | final uri = '$_baseUrl/klines?symbol=$symbol&interval=$interval';
22 | final res = await _networkService.get(uri);
23 |
24 | return (res as List)
25 | .map((e) => CandleData.fromBinanceJson(e, interval, symbol))
26 | .toList();
27 | } on IFailure {
28 | rethrow;
29 | } catch (e) {
30 | throw Failure(message: e.toString());
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector 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.Create(L"dao_preview", 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 |
--------------------------------------------------------------------------------
/lib/models/orderbook_data.dart:
--------------------------------------------------------------------------------
1 | class OrderbookData {
2 | final int lastUpdateId;
3 | final List bids;
4 | final List asks;
5 |
6 | OrderbookData({
7 | required this.lastUpdateId,
8 | required this.bids,
9 | required this.asks,
10 | });
11 |
12 | factory OrderbookData.fromJson(Map json) {
13 | return OrderbookData(
14 | lastUpdateId: json['lastUpdateId'],
15 | bids: (json['bids'] as List)
16 | .map((e) => OrderItemData.fromJson(
17 | (e as List).map((e) => e.toString()).toList()))
18 | .toList(),
19 | asks: (json['asks'] as List)
20 | .map((e) => OrderItemData.fromJson(
21 | (e as List).map((e) => e.toString()).toList()))
22 | .toList(),
23 | );
24 | }
25 | }
26 |
27 | class OrderItemData {
28 | final String price;
29 | final String quantity;
30 |
31 | OrderItemData({
32 | required this.price,
33 | required this.quantity,
34 | });
35 |
36 | factory OrderItemData.fromJson(List json) {
37 | return OrderItemData(
38 | price: json[0],
39 | quantity: json[1],
40 | );
41 | }
42 |
43 | String get total =>
44 | (double.parse(price) * double.parse(quantity)).toStringAsFixed(2);
45 | String get formattedPrice => double.parse(price).toStringAsFixed(2);
46 |
47 | double get ratio => (double.parse(total) / double.parse(price));
48 | double get ratioPercent => ratio * 100;
49 | }
50 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class AppColors {
4 | AppColors._();
5 |
6 | /// Neutral
7 | static const transparent = Colors.transparent;
8 | static const black = Colors.black;
9 | static const white = Colors.white;
10 |
11 | /// Light
12 | static const lightBg = Color(0xFFFFFFFF);
13 | static const lightPrimary = Color(0xFF1C2127);
14 | static const lightSecondary = Color(0xFFF1F1F1);
15 | static const lightOnSecondary = Color(0xFF737A91);
16 | static const lightActive = Color(0xFFCFD3D8);
17 | static const lightActive2 = Color(0xFFFFFFFF);
18 | static const lightActive3 = Color(0xFFFFFFFF);
19 | static const lightSheetBg = Color(0xFFFFFFFF);
20 |
21 | /// Dark
22 | static const darkBg = Color(0xFF17181B);
23 | static const darkPrimary = Color(0xFFFFFFFF);
24 | static const darkSecondary = Color(0xFF1C2127);
25 | static const darkOnSecondary = Color(0xFFA7B1BC);
26 | static const darkActive = Color(0xFF555C63);
27 | static const darkActive2 = Color(0xFF21262C);
28 | static const darkActive3 = Color(0xFF21262C);
29 | static const darkSheetBg = Color(0xFF20252B);
30 | static const darkFieldBorder = Color(0xFF373B3F);
31 |
32 | // Common
33 | static const green = Color(0xFF25C26E);
34 | static const red = Color(0xFFFF554A);
35 | static const gradientPurple = Color(0xFF483BEB);
36 | static const gradientViolet = Color(0xFF7847E1);
37 | static const gradentRed = Color(0xFFDD568D);
38 | static const blue = Color(0xFF2764FF);
39 | }
40 |
--------------------------------------------------------------------------------
/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 | analyzer:
12 | exclude:
13 | - lib/core/app/app.*.dart
14 | linter:
15 | # The lint rules applied to this project can be customized in the
16 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
17 | # included above or to enable additional rules. A list of all available lints
18 | # and their documentation is published at https://dart.dev/lints.
19 | #
20 | # Instead of disabling a lint rule for the entire project in the
21 | # section below, it can also be suppressed for a single line of code
22 | # or a specific dart file by using the `// ignore: name_of_lint` and
23 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
24 | # producing the lint.
25 | rules:
26 | avoid_print: true
27 | prefer_single_quotes: true
28 | prefer_relative_imports: true
29 | always_declare_return_types: true
30 |
31 | # Additional information about this file can be found at
32 | # https://dart.dev/guides/language/analysis-options
33 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/core/app/app.locator.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // StackedLocatorGenerator
5 | // **************************************************************************
6 |
7 | // ignore_for_file: public_member_api_docs, implementation_imports, depend_on_referenced_packages
8 |
9 | import 'package:stacked_services/src/bottom_sheet/bottom_sheet_service.dart';
10 | import 'package:stacked_services/src/navigation/navigation_service.dart';
11 | import 'package:stacked_shared/stacked_shared.dart';
12 |
13 | import '../../services/api_services/binance_service/binance_service.dart';
14 | import '../../services/api_services/binance_service/i_binance_service.dart';
15 | import '../../services/core_services/network_service/i_network_service.dart';
16 | import '../../services/core_services/network_service/network_service.dart';
17 | import '../../services/core_services/websocket_service/i_websocket_service.dart';
18 | import '../../services/core_services/websocket_service/websocket_service.dart';
19 |
20 | final locator = StackedLocator.instance;
21 |
22 | Future setupLocator({
23 | String? environment,
24 | EnvironmentFilter? environmentFilter,
25 | }) async {
26 | // Register environments
27 | locator.registerEnvironment(
28 | environment: environment, environmentFilter: environmentFilter);
29 |
30 | // Register dependencies
31 | locator.registerLazySingleton(() => NavigationService());
32 | locator.registerLazySingleton(() => BottomSheetService());
33 | locator.registerLazySingleton(() => WebSocketService());
34 | locator.registerLazySingleton(() => NetworkService());
35 | locator.registerLazySingleton(() => BinanceService());
36 | }
37 |
--------------------------------------------------------------------------------
/assets/svgs/expand.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Dao Preview
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | dao_preview
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
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: "54e66469a933b60ddf175f858f82eaeb97e48c8d"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
17 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
18 | - platform: android
19 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
20 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
21 | - platform: ios
22 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
23 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
24 | - platform: linux
25 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
26 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
27 | - platform: macos
28 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
29 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
30 | - platform: web
31 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
32 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
33 | - platform: windows
34 | create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
35 | base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/widgets/pop_menu.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../../../core/_core.dart';
4 | import '../../../shared/_shared.dart';
5 |
6 | class PopMenu extends StatelessWidget {
7 | final OverlayPortalController controller;
8 | const PopMenu({
9 | super.key,
10 | required this.controller,
11 | });
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Positioned(
16 | top: kToolbarHeight + 5,
17 | right: 5,
18 | child: SizedBox(
19 | width: 214,
20 | child: Material(
21 | color: context.theme.cardColor,
22 | child: Column(
23 | mainAxisSize: MainAxisSize.min,
24 | crossAxisAlignment: CrossAxisAlignment.stretch,
25 | children: [
26 | if (!context.isDark)
27 | const AppTextField(
28 | hint: 'Search',
29 | suffix: Icon(
30 | Icons.search,
31 | color: AppColors.blue,
32 | ),
33 | ),
34 | ...['Exchange', 'Wallets', 'Roqqu Hub', 'Log out'].map(
35 | (e) => InkWell(
36 | onTap: () => controller.toggle(),
37 | child: Container(
38 | color: e == 'Wallets' ? context.cScheme.secondary : null,
39 | padding: const EdgeInsets.symmetric(
40 | horizontal: 16, vertical: 13),
41 | child: Text(
42 | e,
43 | style: AppTextStyles.medium16.copyWith(
44 | color: context.cScheme.onBackground,
45 | ),
46 | ),
47 | ),
48 | ),
49 | )
50 | ],
51 | ),
52 | ),
53 | ),
54 | );
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38 |
39 | # Run the Flutter tool portions of the build. This must not be removed.
40 | add_dependencies(${BINARY_NAME} flutter_assemble)
41 |
--------------------------------------------------------------------------------
/lib/core/interceptors/logger_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart';
4 |
5 | import '../app/_app.dart';
6 |
7 | class NetworkLoggerInterceptor implements Interceptor {
8 | final _logger = getLogger('ApiLoggerInterceptor');
9 | @override
10 | void onError(DioException err, ErrorInterceptorHandler handler) {
11 | _logger.e(
12 | '\n'
13 | '------------------- METHOD: ${err.requestOptions.method}\n'
14 | '------------------- ENDPOINT: ${err.requestOptions.uri}\n'
15 | '------------------- STATUSCODE: ${err.response?.statusCode} \n'
16 | '------------------- MESSAGE: \n ${jsonEncode(err.response?.data ?? err.message ?? err.error.toString())}\n',
17 | );
18 | handler.next(err);
19 | }
20 |
21 | @override
22 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
23 | _logger.d(
24 | '\n'
25 | '''===================================================================\n\n'''
26 | '>>>>>>>>>>>>>>>>>>>> METHOD: ${options.method}\n'
27 | '>>>>>>>>>>>>>>>>>>>> ENDPOINT: ${options.uri}\n'
28 | '''>>>>>>>>>>>>>>>>>>>> REQUEST DATA:\n'''
29 | '''${options.data ?? options.queryParameters}\n'''
30 | '''===================================================================\n\n''',
31 | );
32 | handler.next(options);
33 | }
34 |
35 | @override
36 | void onResponse(Response response, ResponseInterceptorHandler handler) {
37 | _logger.d(
38 | '\n'
39 | '''===================================================================\n\n'''
40 | '<<<<<<<<<<<<<< METHOD: ${response.requestOptions.method}\n'
41 | '<<<<<<<<<<<<<< ENDPOINT: ${response.requestOptions.uri}\n'
42 | '<<<<<<<<<<<<<< STATUSCODE: ${response.statusCode}\n'
43 | '''<<<<<<<<<<<<<< RESPONSE DATA:\n '''
44 | '''$response\n'''
45 | '''===================================================================\n\n''',
46 | );
47 | handler.next(response);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/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 | -1; // remove the trailing null character
52 | int input_length = (int)wcslen(utf16_string);
53 | std::string utf8_string;
54 | if (target_length <= 0 || target_length > utf8_string.max_size()) {
55 | return utf8_string;
56 | }
57 | utf8_string.resize(target_length);
58 | int converted_length = ::WideCharToMultiByte(
59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
60 | input_length, utf8_string.data(), target_length, nullptr, nullptr);
61 | if (converted_length == 0) {
62 | return std::string();
63 | }
64 | return utf8_string;
65 | }
66 |
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | dao_preview
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/lib/ui/shared/components/general/section_item.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../../../core/_core.dart';
4 | import '../../_shared.dart';
5 |
6 | class SectionItem extends StatelessWidget {
7 | final String label;
8 | final bool isActive;
9 | final Color? activeBorderColor;
10 | final VoidCallback? onTap;
11 |
12 | const SectionItem({
13 | super.key,
14 | required this.label,
15 | this.isActive = false,
16 | this.activeBorderColor,
17 | this.onTap,
18 | });
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return InkWell(
23 | onTap: onTap,
24 | child: Container(
25 | margin: const EdgeInsets.all(3),
26 | alignment: Alignment.center,
27 | decoration: BoxDecoration(
28 | color: isActive
29 | ? context.cScheme.secondaryContainer
30 | .withOpacity(context.isDark ? .5 : 1)
31 | : AppColors.transparent,
32 | borderRadius: BorderRadius.circular(8),
33 | border: Border.all(
34 | color: isActive
35 | ? activeBorderColor ?? context.cScheme.secondary
36 | : Colors.transparent,
37 | width: 1,
38 | ),
39 | boxShadow: [
40 | if (isActive && !context.isDark) ...[
41 | BoxShadow(
42 | color: AppColors.black.withOpacity(.04),
43 | blurRadius: 1,
44 | offset: const Offset(0, 3),
45 | ),
46 | BoxShadow(
47 | color: AppColors.black.withOpacity(.12),
48 | blurRadius: 8,
49 | offset: const Offset(0, 3),
50 | ),
51 | ]
52 | ],
53 | ),
54 | child: Text(
55 | label,
56 | style: (isActive ? AppTextStyles.bold14 : AppTextStyles.medium14)
57 | .copyWith(
58 | color: isActive
59 | ? context.cScheme.onBackground
60 | : context.cScheme.onSecondary,
61 | ),
62 | ),
63 | ),
64 | );
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/lib/core/extensions/context_extenstion.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | extension Contexter on BuildContext {
4 | /// Returns the theme defined in the current theme context.
5 | ThemeData get theme => Theme.of(this);
6 |
7 | /// Returns the text theme defined in the current theme context.
8 | ///
9 | /// This extension method retrieves the [TextTheme] defined in the
10 | /// [ThemeData] associated with the current [BuildContext]. It allows
11 | /// convenient access to the text-related styling configurations, such as
12 | /// font sizes, font weights, and font families, that are defined for
13 | /// various text elements within the application.
14 | TextTheme get tTheme => Theme.of(this).textTheme;
15 |
16 | /// Returns the color scheme defined in the current theme context.
17 | ///
18 | /// This extension method retrieves the [ColorScheme] defined in the
19 | /// [ThemeData] associated with the current [BuildContext]. It allows
20 | /// convenient access to the color-related styling configurations, such as
21 | /// primary color, secondary color, background color, surface color, etc.,
22 | /// that are defined for different parts of the application's UI.
23 | ColorScheme get cScheme => Theme.of(this).colorScheme;
24 |
25 | /// Returns a boolean indicating whether the current theme is dark.
26 | bool get isDark => cScheme.brightness == Brightness.dark;
27 |
28 | /// Returns the size of the screen in logical pixels.
29 | ///
30 | /// This extension method retrieves the size of the screen in logical pixels
31 | /// as a [Size] object. It allows convenient access to the width and height
32 | /// of the screen, which can be useful for creating responsive UIs that adapt
33 | /// to the size of the screen on which the application is running.
34 | Size get screenSize => MediaQuery.sizeOf(this);
35 |
36 | /// Returns whether the screen is in landscape orientation.
37 | ///
38 | /// This extension method retrieves the orientation of the screen as a
39 | /// [bool] value indicating whether the screen is in landscape orientation.
40 | bool get isTablet => screenSize.width > 600;
41 | }
42 |
--------------------------------------------------------------------------------
/lib/models/symbol_data.dart:
--------------------------------------------------------------------------------
1 | class SymbolData {
2 | final String symbol;
3 | final double priceChange;
4 | final double priceChangePercent;
5 | final double lastPrice;
6 | final double lastQty;
7 | final double open;
8 | final double high;
9 | final double low;
10 | final double volume;
11 | final double amount;
12 | final double bidPrice;
13 | final double askPrice;
14 | final int openTime;
15 | final int closeTime;
16 | final int firstTradeId;
17 | final int tradeCount;
18 | final double strikePrice;
19 | final double exercisePrice;
20 |
21 | SymbolData({
22 | required this.symbol,
23 | required this.priceChange,
24 | required this.priceChangePercent,
25 | required this.lastPrice,
26 | required this.lastQty,
27 | required this.open,
28 | required this.high,
29 | required this.low,
30 | required this.volume,
31 | required this.amount,
32 | required this.bidPrice,
33 | required this.askPrice,
34 | required this.openTime,
35 | required this.closeTime,
36 | required this.firstTradeId,
37 | required this.tradeCount,
38 | required this.strikePrice,
39 | required this.exercisePrice,
40 | });
41 |
42 | factory SymbolData.fromJson(Map json) {
43 | return SymbolData(
44 | symbol: json['symbol'],
45 | priceChange: double.parse(json['priceChange']),
46 | priceChangePercent: double.parse(json['priceChangePercent']),
47 | lastPrice: double.parse(json['lastPrice']),
48 | lastQty: double.parse(json['lastQty']),
49 | open: double.parse(json['open']),
50 | high: double.parse(json['high']),
51 | low: double.parse(json['low']),
52 | volume: double.parse(json['volume']),
53 | amount: double.parse(json['amount']),
54 | bidPrice: double.parse(json['bidPrice']),
55 | askPrice: double.parse(json['askPrice']),
56 | openTime: json['openTime'],
57 | closeTime: json['closeTime'],
58 | firstTradeId: json['firstTradeId'],
59 | tradeCount: json['tradeCount'],
60 | strikePrice: double.parse(json['strikePrice']),
61 | exercisePrice: double.parse(json['exercisePrice']),
62 | );
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 |
15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16 | if (flutterVersionCode == null) {
17 | flutterVersionCode = '1'
18 | }
19 |
20 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
21 | if (flutterVersionName == null) {
22 | flutterVersionName = '1.0'
23 | }
24 |
25 | android {
26 | namespace "com.example.dao_preview"
27 | compileSdk flutter.compileSdkVersion
28 | ndkVersion flutter.ndkVersion
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 |
35 | kotlinOptions {
36 | jvmTarget = '1.8'
37 | }
38 |
39 | sourceSets {
40 | main.java.srcDirs += 'src/main/kotlin'
41 | }
42 |
43 | defaultConfig {
44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
45 | applicationId "com.example.dao_preview"
46 | // You can update the following values to match your application needs.
47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
48 | minSdkVersion flutter.minSdkVersion
49 | targetSdkVersion flutter.targetSdkVersion
50 | versionCode flutterVersionCode.toInteger()
51 | versionName flutterVersionName
52 | }
53 |
54 | buildTypes {
55 | release {
56 | // TODO: Add your own signing config for the release build.
57 | // Signing with the debug keys for now, so `flutter run --release` works.
58 | signingConfig signingConfigs.debug
59 | }
60 | }
61 | }
62 |
63 | flutter {
64 | source '../..'
65 | }
66 |
67 | dependencies {}
68 |
--------------------------------------------------------------------------------
/lib/ui/shared/components/general/scrollable_column.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ScrollableColumn extends StatelessWidget {
4 | final List? children;
5 | final CrossAxisAlignment crossAxisAlignment;
6 | final MainAxisAlignment mainAxisAlignment;
7 | final VerticalDirection verticalDirection;
8 | final TextDirection? textDirection;
9 | final TextBaseline? textBaseline;
10 | final EdgeInsetsGeometry padding;
11 | final ScrollPhysics? physics;
12 |
13 | const ScrollableColumn({
14 | super.key,
15 | CrossAxisAlignment? crossAxisAlignment,
16 | MainAxisAlignment? mainAxisAlignment,
17 | VerticalDirection? verticalDirection,
18 | EdgeInsetsGeometry? padding,
19 | this.children,
20 | this.textDirection,
21 | this.textBaseline,
22 | this.physics,
23 | }) : crossAxisAlignment = crossAxisAlignment ?? CrossAxisAlignment.center,
24 | mainAxisAlignment = mainAxisAlignment ?? MainAxisAlignment.start,
25 | verticalDirection = verticalDirection ?? VerticalDirection.down,
26 | padding = padding ?? EdgeInsets.zero;
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | final children = [const SizedBox(width: double.infinity)];
31 |
32 | if (this.children != null) children.addAll(this.children!);
33 | return LayoutBuilder(
34 | builder: (context, constraint) {
35 | return SingleChildScrollView(
36 | physics: physics,
37 | padding: padding,
38 | child: ConstrainedBox(
39 | constraints: BoxConstraints(
40 | minHeight: constraint.maxHeight - padding.vertical,
41 | ),
42 | child: IntrinsicHeight(
43 | child: Column(
44 | crossAxisAlignment: crossAxisAlignment,
45 | mainAxisAlignment: mainAxisAlignment,
46 | mainAxisSize: MainAxisSize.max,
47 | verticalDirection: verticalDirection,
48 | textBaseline: textBaseline,
49 | textDirection: textDirection,
50 | children: children,
51 | ),
52 | ),
53 | ),
54 | );
55 | },
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/app_textstyles.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 |
3 | class AppTextStyles {
4 | static const lexend = 'Lexend';
5 |
6 | static TextStyle dynamic(
7 | double size, {
8 | Color? color,
9 | FontWeight? weight,
10 | double? height,
11 | double? spacing,
12 | FontStyle? style,
13 | String? fontFamily,
14 | }) {
15 | return TextStyle(
16 | fontFamily: fontFamily ?? lexend,
17 | fontSize: size,
18 | color: color,
19 | fontWeight: weight,
20 | height: height == null ? null : height / size,
21 | letterSpacing: spacing,
22 | fontStyle: style,
23 | );
24 | }
25 |
26 | /// Regular
27 | static const regular12 = TextStyle(
28 | fontSize: 12,
29 | fontWeight: FontWeight.normal,
30 | height: 1.5,
31 | );
32 |
33 | static const regular14 = TextStyle(
34 | fontSize: 14,
35 | fontWeight: FontWeight.normal,
36 | height: 1.5,
37 | );
38 |
39 | static const regular16 = TextStyle(
40 | fontSize: 16,
41 | fontWeight: FontWeight.normal,
42 | height: 1.5,
43 | );
44 |
45 | /// Medium
46 | static const medium12 = TextStyle(
47 | fontSize: 12,
48 | fontWeight: FontWeight.w500,
49 | height: 1.67,
50 | );
51 |
52 | static const medium14 = TextStyle(
53 | fontSize: 14,
54 | fontWeight: FontWeight.w500,
55 | height: 1.7,
56 | );
57 |
58 | static const medium16 = TextStyle(
59 | fontSize: 16,
60 | fontWeight: FontWeight.w500,
61 | height: 1.5,
62 | );
63 |
64 | static const medium18 = TextStyle(
65 | fontSize: 18,
66 | fontWeight: FontWeight.w500,
67 | height: 1.78,
68 | );
69 |
70 | /// Bold
71 | static const bold14 = TextStyle(
72 | fontSize: 14,
73 | fontWeight: FontWeight.bold,
74 | height: 1.5,
75 | );
76 |
77 | static const bold16 = TextStyle(
78 | fontSize: 16,
79 | fontWeight: FontWeight.bold,
80 | height: 1.5,
81 | );
82 |
83 | static const bold18 = TextStyle(
84 | fontSize: 18,
85 | fontWeight: FontWeight.bold,
86 | letterSpacing: -0.27,
87 | height: 1.25,
88 | );
89 |
90 | static const bold32 = TextStyle(
91 | fontSize: 32,
92 | fontWeight: FontWeight.bold,
93 | letterSpacing: -0.8,
94 | height: 1.25,
95 | );
96 | }
97 |
--------------------------------------------------------------------------------
/assets/svgs/candle_chart.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
32 |
33 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/lib/core/app/app.router.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // StackedNavigatorGenerator
5 | // **************************************************************************
6 |
7 | // ignore_for_file: no_leading_underscores_for_library_prefixes
8 | import 'package:dao_preview/ui/views/home_view/home_view.dart' as _i2;
9 | import 'package:flutter/material.dart';
10 | import 'package:stacked/stacked.dart' as _i1;
11 | import 'package:stacked_services/stacked_services.dart' as _i3;
12 |
13 | class Routes {
14 | static const homeView = '/';
15 |
16 | static const all = {homeView};
17 | }
18 |
19 | class StackedRouter extends _i1.RouterBase {
20 | final _routes = <_i1.RouteDef>[
21 | _i1.RouteDef(
22 | Routes.homeView,
23 | page: _i2.HomeView,
24 | )
25 | ];
26 |
27 | final _pagesMap = {
28 | _i2.HomeView: (data) {
29 | return _i1.buildAdaptivePageRoute(
30 | builder: (context) => const _i2.HomeView(),
31 | settings: data,
32 | );
33 | }
34 | };
35 |
36 | @override
37 | List<_i1.RouteDef> get routes => _routes;
38 |
39 | @override
40 | Map get pagesMap => _pagesMap;
41 | }
42 |
43 | extension NavigatorStateExtension on _i3.NavigationService {
44 | Future navigateToHomeView([
45 | int? routerId,
46 | bool preventDuplicates = true,
47 | Map? parameters,
48 | Widget Function(BuildContext, Animation, Animation, Widget)?
49 | transition,
50 | ]) async {
51 | return navigateTo(Routes.homeView,
52 | id: routerId,
53 | preventDuplicates: preventDuplicates,
54 | parameters: parameters,
55 | transition: transition);
56 | }
57 |
58 | Future replaceWithHomeView([
59 | int? routerId,
60 | bool preventDuplicates = true,
61 | Map? parameters,
62 | Widget Function(BuildContext, Animation, Animation, Widget)?
63 | transition,
64 | ]) async {
65 | return replaceWith(Routes.homeView,
66 | id: routerId,
67 | preventDuplicates: preventDuplicates,
68 | parameters: parameters,
69 | transition: transition);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/test/services/api_services/binance_service_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:dao_preview/core/app/_app.dart';
2 | import 'package:dao_preview/models/_models.dart';
3 | import 'package:dao_preview/services/api_services/binance_service/binance_service.dart';
4 | import 'package:dao_preview/services/core_services/network_service/i_network_service.dart';
5 | import 'package:flutter_test/flutter_test.dart';
6 | import 'package:mocktail/mocktail.dart';
7 |
8 | import '../../helpers/service_helpers.dart';
9 |
10 | void main() {
11 | group('Binance Service Test - ', () {
12 | late INetworkService networkService;
13 | late BinanceService binanceService;
14 |
15 | setUp(() {
16 | registerServices();
17 | networkService = locator();
18 | binanceService = BinanceService();
19 | });
20 |
21 | tearDown(() {
22 | unregisterServices();
23 | });
24 |
25 | group('fetchCandles - ', () {
26 | final res = [
27 | [
28 | 1499040000000, // Kline open time
29 | '0.01634790', // Open price
30 | '0.80000000', // High price
31 | '0.01575800', // Low price
32 | '0.01577100', // Close price
33 | '148976.11427815', // Volume
34 | 1499644799999, // Kline close time
35 | '2434.19055334', // Quote asset volume
36 | 308, // Number of trades
37 | '1756.87402397', // Taker buy base asset volume
38 | '28.46694368', // Taker buy quote asset volume
39 | '0' // Unused field. Ignore.
40 | ]
41 | ];
42 |
43 | test('Should return a list of CandleData objects', () async {
44 | when(() => networkService.get(any())).thenAnswer((_) async => res);
45 |
46 | final candles = await binanceService.fetchCandles('BTCUSDT', '1m');
47 |
48 | expect(candles.length, 1);
49 | expect(candles.first.open, 0.01634790);
50 | });
51 |
52 | test('Should throw a Failure when the network request fails', () async {
53 | when(() => networkService.get(any())).thenThrow(InternetFailure());
54 |
55 | IFailure? failure;
56 | try {
57 | await binanceService.fetchCandles('BTCUSDT', '1m');
58 | } on IFailure catch (e) {
59 | failure = e;
60 | }
61 |
62 | expect(failure, isNotNull);
63 | });
64 | });
65 | });
66 | }
67 |
--------------------------------------------------------------------------------
/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 |
30 | flutter_controller_->engine()->SetNextFrameCallback([&]() {
31 | this->Show();
32 | });
33 |
34 | // Flutter can complete the first frame before the "show window" callback is
35 | // registered. The following call ensures a frame is pending to ensure the
36 | // window is shown. It is a no-op if the first frame hasn't completed yet.
37 | flutter_controller_->ForceRedraw();
38 |
39 | return true;
40 | }
41 |
42 | void FlutterWindow::OnDestroy() {
43 | if (flutter_controller_) {
44 | flutter_controller_ = nullptr;
45 | }
46 |
47 | Win32Window::OnDestroy();
48 | }
49 |
50 | LRESULT
51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
52 | WPARAM const wparam,
53 | LPARAM const lparam) noexcept {
54 | // Give Flutter, including plugins, an opportunity to handle window messages.
55 | if (flutter_controller_) {
56 | std::optional result =
57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
58 | lparam);
59 | if (result) {
60 | return *result;
61 | }
62 | }
63 |
64 | switch (message) {
65 | case WM_FONTCHANGE:
66 | flutter_controller_->engine()->ReloadSystemFonts();
67 | break;
68 | }
69 |
70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
71 | }
72 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.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 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/spacing.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// ExtraTiny space = 2
4 | ///
5 | /// Tiny space = 4
6 | ///
7 | /// Small space = 8
8 | ///
9 | /// Regular space = 16
10 | ///
11 | /// Medium space = 24
12 | ///
13 | /// ExtraMedium space = 32
14 | ///
15 | /// Large space = 48
16 | ///
17 | /// ExtraLarge space = 72
18 | ///
19 | /// ExtraExtraLarge space = 96
20 | class Spacing extends StatelessWidget {
21 | final double height;
22 | final double width;
23 |
24 | const Spacing({
25 | super.key,
26 | this.height = 0,
27 | this.width = 0,
28 | });
29 |
30 | @override
31 | Widget build(BuildContext context) {
32 | return SizedBox(height: height, width: width);
33 | }
34 |
35 | /// Empty
36 | factory Spacing.empty() => const Spacing();
37 |
38 | // Horizontal Spacing
39 | /// Spacing = 2
40 | factory Spacing.horizExtraTiny() => const Spacing(width: 2);
41 |
42 | /// Spacing = 4
43 | factory Spacing.horizTiny() => const Spacing(width: 4);
44 |
45 | /// Spacing = 8
46 | factory Spacing.horizSmall() => const Spacing(width: 8);
47 |
48 | /// Spacing = 16
49 | factory Spacing.horizRegular() => const Spacing(width: 16);
50 |
51 | /// Spacing = 24
52 | factory Spacing.horizMedium() => const Spacing(width: 24);
53 |
54 | /// Spacing = 32
55 | factory Spacing.horizExtraMedium() => const Spacing(width: 32);
56 |
57 | /// Spacing = 48
58 | factory Spacing.horizLarge() => const Spacing(width: 48);
59 |
60 | /// Spacing = 72
61 | factory Spacing.horizExtraLarge() => const Spacing(width: 72);
62 |
63 | /// Spacing = 96
64 | factory Spacing.horizExtraExtraLarge() => const Spacing(width: 96);
65 |
66 | // Vertical Spacing
67 | /// Spacing = 2
68 | factory Spacing.vertExtraTiny() => const Spacing(height: 2);
69 |
70 | /// Spacing = 4
71 | factory Spacing.vertTiny() => const Spacing(height: 4);
72 |
73 | /// Spacing = 8
74 | factory Spacing.vertSmall() => const Spacing(height: 8);
75 |
76 | /// Spacing = 16
77 | factory Spacing.vertRegular() => const Spacing(height: 16);
78 |
79 | /// Spacing = 24
80 | factory Spacing.vertMedium() => const Spacing(height: 24);
81 |
82 | /// Spacing = 32
83 | factory Spacing.vertExtraMedium() => const Spacing(height: 32);
84 |
85 | /// Spacing = 48
86 | factory Spacing.vertLarge() => const Spacing(height: 48);
87 |
88 | /// Spacing = 72
89 | factory Spacing.vertExtraLarge() => const Spacing(height: 72);
90 |
91 | /// Spacing = 96
92 | factory Spacing.vertExtraExtraLarge() => const Spacing(height: 96);
93 | }
94 |
--------------------------------------------------------------------------------
/assets/svgs/btc_usdt.svg:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/widgets/orders_section.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:stacked/stacked.dart';
3 |
4 | import '../../../../core/_core.dart';
5 | import '../../../shared/_shared.dart';
6 | import '../home_viewmodel.dart';
7 |
8 | class OrdersSection extends ViewModelWidget {
9 | const OrdersSection({
10 | super.key,
11 | });
12 |
13 | @override
14 | Widget build(BuildContext context, HomeViewModel viewModel) {
15 | return Container(
16 | color: context.cScheme.background,
17 | child: Column(
18 | children: [
19 | SizedBox(
20 | height: 45,
21 | child: ListView(
22 | scrollDirection: Axis.horizontal,
23 | children: [
24 | Container(
25 | margin: const EdgeInsets.symmetric(horizontal: 16),
26 | decoration: BoxDecoration(
27 | color: context.isDark
28 | ? AppColors.black.withOpacity(.16)
29 | : context.cScheme.secondary,
30 | borderRadius: BorderRadius.circular(8),
31 | ),
32 | child: Row(
33 | children: OrdersViewEnum.values
34 | .map((filter) => SizedBox(
35 | width: 159,
36 | child: SectionItem(
37 | label: filter.value,
38 | isActive: viewModel.ordersView == filter,
39 | onTap: () => viewModel.setOrdersView(filter),
40 | ),
41 | ))
42 | .toList(),
43 | ),
44 | ),
45 | ],
46 | ),
47 | ),
48 | Spacing.vertRegular(),
49 | Container(
50 | color: context.cScheme.background,
51 | padding: const EdgeInsets.symmetric(horizontal: 48, vertical: 72),
52 | child: Column(
53 | children: [
54 | const Text(
55 | 'No Open Orders',
56 | style: AppTextStyles.bold18,
57 | ),
58 | Spacing.vertSmall(),
59 | Text(
60 | 'Lorem ipsum dolor sit amet, consectetura dipiscing elit. Id pulvinar nullam sit imperdiet pulvinar.',
61 | textAlign: TextAlign.center,
62 | style: AppTextStyles.medium14.copyWith(
63 | color: context.cScheme.onSecondary,
64 | ),
65 | )
66 | ],
67 | ),
68 | ),
69 | ],
70 | ),
71 | );
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/test/helpers/service_helpers.dart:
--------------------------------------------------------------------------------
1 | import 'package:dao_preview/core/app/_app.dart';
2 | import 'package:dao_preview/services/api_services/_api_services.dart';
3 | import 'package:dao_preview/services/core_services/_core_services.dart';
4 | import 'package:mocktail/mocktail.dart';
5 |
6 | /// Stacked services mock
7 | class MockBottomSheetService extends Mock implements BottomSheetService {}
8 |
9 | class MockNavigationService extends Mock implements NavigationService {}
10 |
11 | class MockSnackbarService extends Mock implements SnackbarService {}
12 |
13 | /// GigMile services mock
14 |
15 | class MockNetworkService extends Mock implements INetworkService {}
16 |
17 | class MockWebSocketService extends Mock implements IWebSocketService {}
18 |
19 | class MockBinanceService extends Mock implements IBinanceService {}
20 |
21 | void _removeRegistrationIfExists() {
22 | if (locator.isRegistered()) {
23 | locator.unregister();
24 | }
25 | }
26 |
27 | BottomSheetService getAndRegisterBottomSheetService() {
28 | _removeRegistrationIfExists();
29 | final service = MockBottomSheetService();
30 | locator.registerSingleton(service);
31 | return service;
32 | }
33 |
34 | NavigationService getAndRegisterNavigationService() {
35 | _removeRegistrationIfExists();
36 | final service = MockNavigationService();
37 | locator.registerSingleton(service);
38 | return service;
39 | }
40 |
41 | SnackbarService getAndRegisterSnackbarService() {
42 | _removeRegistrationIfExists();
43 | final service = MockSnackbarService();
44 | locator.registerSingleton(service);
45 | return service;
46 | }
47 |
48 | INetworkService getAndRegisterNetworkService() {
49 | _removeRegistrationIfExists();
50 | final service = MockNetworkService();
51 | locator.registerSingleton(service);
52 | return service;
53 | }
54 |
55 | IWebSocketService getAndRegisterWebSocketService() {
56 | _removeRegistrationIfExists();
57 | final service = MockWebSocketService();
58 | locator.registerSingleton(service);
59 | return service;
60 | }
61 |
62 | IBinanceService getAndRegisterBinanceService() {
63 | _removeRegistrationIfExists();
64 | final service = MockBinanceService();
65 | locator.registerSingleton(service);
66 | return service;
67 | }
68 |
69 | void registerServices() {
70 | getAndRegisterBottomSheetService();
71 | getAndRegisterNavigationService();
72 | getAndRegisterSnackbarService();
73 | getAndRegisterNetworkService();
74 | getAndRegisterWebSocketService();
75 | getAndRegisterBinanceService();
76 | }
77 |
78 | void unregisterServices() {
79 | locator.unregister();
80 | locator.unregister();
81 | locator.unregister();
82 | locator.unregister();
83 | locator.unregister();
84 | locator.unregister();
85 | }
86 |
--------------------------------------------------------------------------------
/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/lib/models/failure.dart:
--------------------------------------------------------------------------------
1 | abstract class IFailure {
2 | final String message;
3 | final dynamic data;
4 |
5 | IFailure({
6 | required this.message,
7 | this.data,
8 | });
9 |
10 | @override
11 | String toString() {
12 | return 'Failure{message: $message, data: $data}';
13 | }
14 |
15 | @override
16 | bool operator ==(Object other) =>
17 | identical(this, other) ||
18 | other is IFailure &&
19 | runtimeType == other.runtimeType &&
20 | message == other.message &&
21 | data == other.data;
22 |
23 | @override
24 | int get hashCode => message.hashCode ^ data.hashCode;
25 | }
26 |
27 | class Failure extends IFailure {
28 | Failure({
29 | required super.message,
30 | super.data,
31 | });
32 |
33 | factory Failure.fromHttpErrorMap(Map json) => Failure(
34 | message: json['message'] ?? json['errors']?['Message'],
35 | data: json,
36 | );
37 | }
38 |
39 | /// This is not to be used freely, it should be used as a fallback for errors
40 | /// that need to be handled, especially for the API service where we don't know
41 | /// all the errors beforehand.
42 | class UnknownFailure extends IFailure {
43 | UnknownFailure({
44 | super.data,
45 | super.message =
46 | "Oops! App encountered an issue. We're on it. Please try again later or contact us.",
47 | });
48 | }
49 |
50 | /// Errors that come from API calls that return error codes 500 and above
51 | class InternetFailure extends IFailure {
52 | InternetFailure({
53 | super.data,
54 | super.message = 'Please check your internet connection and try again.',
55 | });
56 | }
57 |
58 | /// Errors that come from API calls that return error codes 500 and above
59 | class ServerFailure extends IFailure {
60 | ServerFailure({
61 | super.data,
62 | super.message =
63 | "Sorry, we're having trouble on our end. Please try again later or contact support for assistance.",
64 | });
65 | }
66 |
67 | /// Errors that come from serializing data
68 | class TypeFailure extends IFailure {
69 | TypeFailure({
70 | super.message =
71 | 'Sorry, we encounted an issue communicating to our server. We are working to fix it',
72 | super.data,
73 | });
74 | }
75 |
76 | /// Errors that come from serializing data
77 | class ValidationFailure extends IFailure {
78 | ValidationFailure({
79 | super.message =
80 | 'Validation Error! Please fill the fields properly or contact support for assistance.',
81 | super.data,
82 | });
83 |
84 | @override
85 | String get message {
86 | if (data == null) return super.message;
87 | if ((data['errors']['Message']).toString().contains('InstancePtr:')) {
88 | return super.message;
89 | }
90 | return (data['errors']['Message']).toString();
91 | }
92 | }
93 |
94 | class CoreFailure extends IFailure {
95 | CoreFailure({
96 | super.message =
97 | 'Sorry, we had an issues setting up things for you. Please contact support!',
98 | super.data,
99 | });
100 | }
101 |
102 | /// This is not to be used freely, it should be used as a fallback for errors
103 | /// that need to be handled, especially for the API service where we don't know
104 | /// all the errors beforehand.
105 | class FallbackFailure extends IFailure {
106 | FallbackFailure({
107 | super.data,
108 | super.message =
109 | "Oops! App encountered an issue. We're on it. Please try again later or contact us.",
110 | });
111 | }
112 |
--------------------------------------------------------------------------------
/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0,0
67 | #endif
68 |
69 | #if defined(FLUTTER_VERSION)
70 | #define VERSION_AS_STRING FLUTTER_VERSION
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.example" "\0"
93 | VALUE "FileDescription", "dao_preview" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "dao_preview" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "dao_preview.exe" "\0"
98 | VALUE "ProductName", "dao_preview" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/lib/models/candle_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:candlesticks/candlesticks.dart';
2 |
3 | final mockCandleData = {
4 | 'stream': 'btcusdt@kline_1s',
5 | 'data': {
6 | 'e': 'kline',
7 | 'E': 1716368409005,
8 | 's': 'BTCUSDT',
9 | 'k': {
10 | 't': 1716368408000,
11 | 'T': 1716368408999,
12 | 's': 'BTCUSDT',
13 | 'i': '1s',
14 | 'f': 3609227777,
15 | 'L': 3609227780,
16 | 'o': '70030.00000000',
17 | 'c': '70030.00000000',
18 | 'h': '70030.00000000',
19 | 'l': '70029.99000000',
20 | 'v': '0.73628000',
21 | 'n': 4,
22 | 'x': true,
23 | 'q': '51561.68831840',
24 | 'V': '0.72812000',
25 | 'Q': '50990.24360000',
26 | 'B': '0'
27 | }
28 | }
29 | };
30 |
31 | class CandleData {
32 | final int startTime;
33 | final int endTime;
34 | final String tradingSymbol;
35 | final String candlePeriod;
36 | final int firstTradeId;
37 | final int lastTradeId;
38 | final double open;
39 | final double close;
40 | final double high;
41 | final double low;
42 | final double volume;
43 | final int numberOfTrades;
44 | final bool isCompleted;
45 | final double completedTradeAmount;
46 | final double takerCompletedTradeVolume;
47 | final double takerTradeAmount;
48 |
49 | CandleData({
50 | required this.startTime,
51 | required this.endTime,
52 | required this.tradingSymbol,
53 | required this.candlePeriod,
54 | required this.firstTradeId,
55 | required this.lastTradeId,
56 | required this.open,
57 | required this.close,
58 | required this.high,
59 | required this.low,
60 | required this.volume,
61 | required this.numberOfTrades,
62 | required this.isCompleted,
63 | required this.completedTradeAmount,
64 | required this.takerCompletedTradeVolume,
65 | required this.takerTradeAmount,
66 | });
67 |
68 | factory CandleData.fromJson(Map json) {
69 | return CandleData(
70 | startTime: json['t'],
71 | endTime: json['T'],
72 | tradingSymbol: json['s'],
73 | candlePeriod: json['i'],
74 | firstTradeId: json['f'],
75 | lastTradeId: json['L'],
76 | open: double.parse(json['o']),
77 | close: double.parse(json['c']),
78 | high: double.parse(json['h']),
79 | low: double.parse(json['l']),
80 | volume: double.parse(json['v']),
81 | numberOfTrades: json['n'],
82 | isCompleted: json['x'],
83 | completedTradeAmount: double.parse(json['q']),
84 | takerCompletedTradeVolume: double.parse(json['V']),
85 | takerTradeAmount: double.parse(json['Q']),
86 | );
87 | }
88 |
89 | factory CandleData.fromBinanceJson(
90 | List json,
91 | String interval,
92 | String symbol,
93 | ) {
94 | return CandleData(
95 | startTime: json[0],
96 | endTime: json[6],
97 | open: double.parse(json[1]),
98 | high: double.parse(json[2]),
99 | low: double.parse(json[3]),
100 | close: double.parse(json[4]),
101 | volume: double.parse(json[5]),
102 | numberOfTrades: json[8],
103 | isCompleted: true,
104 | completedTradeAmount: double.parse(json[7]),
105 | takerCompletedTradeVolume: double.parse(json[9]),
106 | takerTradeAmount: double.parse(json[10]),
107 | candlePeriod: interval,
108 | tradingSymbol: symbol,
109 | firstTradeId: 0,
110 | lastTradeId: 0,
111 | );
112 | }
113 |
114 | Candle toCandle() {
115 | return Candle(
116 | date: DateTime.fromMillisecondsSinceEpoch(startTime),
117 | open: open,
118 | high: high,
119 | low: low,
120 | close: close,
121 | volume: volume,
122 | );
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/lib/services/core_services/websocket_service/websocket_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:convert';
3 |
4 | import 'package:web_socket_channel/status.dart';
5 | import 'package:web_socket_channel/web_socket_channel.dart';
6 |
7 | import '../../../core/_core.dart';
8 | import '../../../core/app/_app.dart';
9 | import '../../../models/_models.dart';
10 | import 'i_websocket_service.dart';
11 |
12 | class WebSocketService extends IWebSocketService {
13 | static const _channel = 'wss://stream.binance.com:443/stream';
14 | final _log = getLogger('WebSocketService');
15 |
16 | StreamSubscription? _klinesSS;
17 |
18 | final StreamController _tickerDataSC =
19 | StreamController.broadcast();
20 | final StreamController> _candleDataSC =
21 | StreamController>.broadcast();
22 | final StreamController _orderbookDataSC =
23 | StreamController.broadcast();
24 |
25 | WebSocketChannel? _klinesSocket;
26 | String? _id;
27 |
28 | @override
29 | Future init() async {
30 | try {
31 | final wsUrl = Uri.parse(_channel);
32 | _klinesSocket = WebSocketChannel.connect(wsUrl);
33 |
34 | await _klinesSocket?.ready;
35 |
36 | _klinesSS = _klinesSocket?.stream.listen((message) {
37 | try {
38 | _log.w('Instance of Message: $message');
39 | message = jsonDecode(message);
40 | if (message['data']?['e'] == '24hrTicker') {
41 | _tickerDataSC.add(TickerData.fromJson(message['data']));
42 | }
43 | if (message['data']?['e'] == 'kline') {
44 | _candleDataSC.add([CandleData.fromJson(message['data']?['k'])]);
45 | }
46 | if (message['data']?['bids'] != null) {
47 | _orderbookDataSC.add(OrderbookData.fromJson(message['data']));
48 | }
49 | } catch (e) {
50 | _log.e('Klines SS Error: $e');
51 | }
52 | });
53 | } on Exception catch (e) {
54 | _log.e(e);
55 | throw CoreFailure(data: e);
56 | }
57 | }
58 |
59 | @override
60 | String subscribeToSymbol(
61 | String symbol,
62 | String interval,
63 | String depth,
64 | ) {
65 | _id = IdUtils.generateId();
66 | symbol = symbol.toLowerCase();
67 |
68 | _klinesSocket?.sink.add(
69 | jsonEncode({
70 | 'method': 'SUBSCRIBE',
71 | 'params': [
72 | '$symbol@ticker',
73 | '$symbol@kline_$interval',
74 | '$symbol@depth$depth',
75 | ],
76 | 'id': IdUtils.generateId(),
77 | }),
78 | );
79 |
80 | return _id!;
81 | }
82 |
83 | @override
84 | Future unsubscribeFromSymbol(
85 | String symbol,
86 | String interval,
87 | String depth,
88 | ) async {
89 | try {
90 | if (_id == null) return;
91 | symbol = symbol.toLowerCase();
92 | _klinesSocket?.sink.add({
93 | 'method': 'UNSUBSCRIBE',
94 | 'params': [
95 | '$symbol@ticker',
96 | '$symbol@kline_$interval',
97 | '$symbol@depth$depth',
98 | ],
99 | 'id': _id,
100 | });
101 |
102 | await init();
103 | } catch (e) {
104 | _log.e(e);
105 | throw CoreFailure(data: e);
106 | }
107 | }
108 |
109 | @override
110 | Future dispose() async {
111 | _klinesSocket?.sink.close(normalClosure);
112 | _klinesSS?.cancel();
113 | }
114 |
115 | @override
116 | Stream get tickerDataStream => _tickerDataSC.stream;
117 | @override
118 | Stream> get candleDataStream => _candleDataSC.stream;
119 | @override
120 | Stream get orderbookDataStream => _orderbookDataSC.stream;
121 | }
122 |
--------------------------------------------------------------------------------
/lib/models/ticker_data.dart:
--------------------------------------------------------------------------------
1 | final mockTickerData = {
2 | 'e': '24hrTicker', // Event type
3 | 'E': 1672515782136, // Event time
4 | 's': 'BNBBTC', // Symbol
5 | 'p': '0.0015', // Price change
6 | 'P': '250.00', // Price change percent
7 | 'w': '0.0018', // Weighted average price
8 | 'x':
9 | '0.0009', // First trade(F)-1 price (first trade before the 24hr rolling window)
10 | 'c': '0.0025', // Last price
11 | 'Q': '10', // Last quantity
12 | 'b': '0.0024', // Best bid price
13 | 'B': '10', // Best bid quantity
14 | 'a': '0.0026', // Best ask price
15 | 'A': '100', // Best ask quantity
16 | 'o': '0.0010', // Open price
17 | 'h': '0.0025', // High price
18 | 'l': '0.0010', // Low price
19 | 'v': '10000', // Total traded base asset volume
20 | 'q': '18', // Total traded quote asset volume
21 | 'O': 0, // Statistics open time
22 | 'C': 86400000, // Statistics close time
23 | 'F': 0, // First trade ID
24 | 'L': 18150, // Last trade Id
25 | 'n': 18151 // Total number of trades
26 | };
27 |
28 | class TickerData {
29 | final String eventType;
30 | final int eventTime;
31 | final String symbol;
32 | final double priceChange;
33 | final double priceChangePercent;
34 | final double weightedAveragePrice;
35 | final double firstTradePrice;
36 | final double lastPrice;
37 | final double lastQuantity;
38 | final double bestBidPrice;
39 | final double bestBidQuantity;
40 | final double bestAskPrice;
41 | final double bestAskQuantity;
42 | final double openPrice;
43 | final double highPrice;
44 | final double lowPrice;
45 | final double totalTradedBaseAssetVolume;
46 | final double totalTradedQuoteAssetVolume;
47 | final int statisticsOpenTime;
48 | final int statisticsCloseTime;
49 | final int firstTradeId;
50 | final int lastTradeId;
51 | final int totalNumberOfTrades;
52 |
53 | TickerData({
54 | required this.eventType,
55 | required this.eventTime,
56 | required this.symbol,
57 | required this.priceChange,
58 | required this.priceChangePercent,
59 | required this.weightedAveragePrice,
60 | required this.firstTradePrice,
61 | required this.lastPrice,
62 | required this.lastQuantity,
63 | required this.bestBidPrice,
64 | required this.bestBidQuantity,
65 | required this.bestAskPrice,
66 | required this.bestAskQuantity,
67 | required this.openPrice,
68 | required this.highPrice,
69 | required this.lowPrice,
70 | required this.totalTradedBaseAssetVolume,
71 | required this.totalTradedQuoteAssetVolume,
72 | required this.statisticsOpenTime,
73 | required this.statisticsCloseTime,
74 | required this.firstTradeId,
75 | required this.lastTradeId,
76 | required this.totalNumberOfTrades,
77 | });
78 |
79 | factory TickerData.fromJson(Map json) {
80 | return TickerData(
81 | eventType: json['e'],
82 | eventTime: json['E'],
83 | symbol: json['s'],
84 | priceChange: double.parse(json['p']),
85 | priceChangePercent: double.parse(json['P']),
86 | weightedAveragePrice: double.parse(json['w']),
87 | firstTradePrice: double.parse(json['x']),
88 | lastPrice: double.parse(json['c']),
89 | lastQuantity: double.parse(json['Q']),
90 | bestBidPrice: double.parse(json['b']),
91 | bestBidQuantity: double.parse(json['B']),
92 | bestAskPrice: double.parse(json['a']),
93 | bestAskQuantity: double.parse(json['A']),
94 | openPrice: double.parse(json['o']),
95 | highPrice: double.parse(json['h']),
96 | lowPrice: double.parse(json['l']),
97 | totalTradedBaseAssetVolume: double.parse(json['v']),
98 | totalTradedQuoteAssetVolume: double.parse(json['q']),
99 | statisticsOpenTime: json['O'],
100 | statisticsCloseTime: json['C'],
101 | firstTradeId: json['F'],
102 | lastTradeId: json['L'],
103 | totalNumberOfTrades: json['n'],
104 | );
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates a win32 window with |title| that is positioned and sized using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size this function will scale the inputted width and height as
35 | // as appropriate for the default monitor. The window is invisible until
36 | // |Show| is called. Returns true if the window was created successfully.
37 | bool Create(const std::wstring& title, const Point& origin, const Size& size);
38 |
39 | // Show the current window. Returns true if the window was successfully shown.
40 | bool Show();
41 |
42 | // Release OS resources associated with window.
43 | void Destroy();
44 |
45 | // Inserts |content| into the window tree.
46 | void SetChildContent(HWND content);
47 |
48 | // Returns the backing Window handle to enable clients to set icon and other
49 | // window properties. Returns nullptr if the window has been destroyed.
50 | HWND GetHandle();
51 |
52 | // If true, closing this window will quit the application.
53 | void SetQuitOnClose(bool quit_on_close);
54 |
55 | // Return a RECT representing the bounds of the current client area.
56 | RECT GetClientArea();
57 |
58 | protected:
59 | // Processes and route salient window messages for mouse handling,
60 | // size change and DPI. Delegates handling of these to member overloads that
61 | // inheriting classes can handle.
62 | virtual LRESULT MessageHandler(HWND window,
63 | UINT const message,
64 | WPARAM const wparam,
65 | LPARAM const lparam) noexcept;
66 |
67 | // Called when CreateAndShow is called, allowing subclass window-related
68 | // setup. Subclasses should return false if setup fails.
69 | virtual bool OnCreate();
70 |
71 | // Called when Destroy is called.
72 | virtual void OnDestroy();
73 |
74 | private:
75 | friend class WindowClassRegistrar;
76 |
77 | // OS callback called by message pump. Handles the WM_NCCREATE message which
78 | // is passed when the non-client area is being created and enables automatic
79 | // non-client DPI scaling so that the non-client area automatically
80 | // responds to changes in DPI. All other messages are handled by
81 | // MessageHandler.
82 | static LRESULT CALLBACK WndProc(HWND const window,
83 | UINT const message,
84 | WPARAM const wparam,
85 | LPARAM const lparam) noexcept;
86 |
87 | // Retrieves a class instance pointer for |window|
88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
89 |
90 | // Update the window frame's theme to match the system theme.
91 | static void UpdateTheme(HWND const window);
92 |
93 | bool quit_on_close_ = false;
94 |
95 | // window handle for top level window.
96 | HWND window_handle_ = nullptr;
97 |
98 | // window handle for hosted content.
99 | HWND child_content_ = nullptr;
100 | };
101 |
102 | #endif // RUNNER_WIN32_WINDOW_H_
103 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
43 |
49 |
50 |
51 |
52 |
53 |
63 |
65 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/home_viewmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:stacked/stacked.dart';
3 |
4 | import '../../../core/_core.dart';
5 | import '../../../core/app/_app.dart';
6 | import '../../../models/_models.dart';
7 | import '../../../services/api_services/_api_services.dart';
8 | import '../../../services/core_services/_core_services.dart';
9 |
10 | class HomeViewModel extends MultipleStreamViewModel {
11 | final _bottomSheetService = locator();
12 | final _webSsocketService = locator();
13 | final _binanceService = locator();
14 | final _log = getLogger('HomeViewModel');
15 |
16 | final String _symbol = 'BTCUSDT';
17 | ChartIntervalEnum _interval = ChartIntervalEnum.oneSecond;
18 | MainViewEnum mainView = MainViewEnum.charts;
19 | List _candles = [];
20 | ValueNotifier tickerData = ValueNotifier(null);
21 | OrdersViewEnum ordersView = OrdersViewEnum.openOrders;
22 | int arrangement = 0;
23 | OrderbookData? orderbookData;
24 | String _depth = '5';
25 |
26 | void setInterval(ChartIntervalEnum value) {
27 | _unsubscribeFromSymbol();
28 | _interval = value;
29 | _candles.clear();
30 | notifyListeners();
31 | fetchCandles();
32 | _subscribeToSymbol();
33 | }
34 |
35 | void setMainView(MainViewEnum value) {
36 | mainView = value;
37 | notifyListeners();
38 | }
39 |
40 | void setOrdersView(OrdersViewEnum value) {
41 | ordersView = value;
42 | notifyListeners();
43 | }
44 |
45 | void setArrangement(int index) {
46 | arrangement = index;
47 | notifyListeners();
48 | }
49 |
50 | void setDepth(String value) {
51 | _unsubscribeFromSymbol();
52 | _depth = value;
53 | notifyListeners();
54 | _subscribeToSymbol();
55 | }
56 |
57 | Future init() async {
58 | try {
59 | setBusy(true);
60 | await _webSsocketService.init();
61 | await fetchCandles();
62 | _subscribeToSymbol();
63 | } on IFailure catch (e) {
64 | _log.e(e);
65 | } finally {
66 | setBusy(false);
67 | }
68 | }
69 |
70 | Future fetchCandles() async {
71 | try {
72 | final candles =
73 | await _binanceService.fetchCandles(_symbol, _interval.value);
74 | _candles = [..._candles, ...candles.reversed];
75 | notifyListeners();
76 | } on IFailure catch (e) {
77 | _log.e(e);
78 | }
79 | }
80 |
81 | void _subscribeToSymbol() {
82 | _webSsocketService.subscribeToSymbol(_symbol, _interval.value, _depth);
83 | }
84 |
85 | void _unsubscribeFromSymbol() {
86 | _webSsocketService.unsubscribeFromSymbol(_symbol, _interval.value, _depth);
87 | }
88 |
89 | void openCreateOrderSheet() {
90 | _bottomSheetService.showCustomSheet(
91 | variant: BottomSheetType.createOrder,
92 | isScrollControlled: true,
93 | );
94 | }
95 |
96 | @override
97 | void dispose() {
98 | super.dispose();
99 | _webSsocketService.dispose();
100 | }
101 |
102 | @override
103 | void onData(String key, data) {
104 | if (key == 'candleDataStream') {
105 | _candles.insertAll(0, data);
106 | }
107 | if (key == 'tickerDataStream') {
108 | tickerData.value = data;
109 | }
110 | if (key == 'orderbookDataStream') {
111 | orderbookData = data;
112 | }
113 | }
114 |
115 | @override
116 | Map get streamsMap => {
117 | 'tickerDataStream':
118 | StreamData(_webSsocketService.tickerDataStream),
119 | 'candleDataStream':
120 | StreamData>(_webSsocketService.candleDataStream),
121 | 'orderbookDataStream':
122 | StreamData(_webSsocketService.orderbookDataStream),
123 | };
124 |
125 | String get symbol => _symbol;
126 | List get candles => _candles;
127 | ChartIntervalEnum get interval => _interval;
128 | String get depth => _depth;
129 | }
130 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
43 |
49 |
50 |
51 |
52 |
53 |
63 |
65 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: dao_preview
2 | description: "A new Flutter project."
3 | # The following line prevents the package from being accidentally published to
4 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
6 |
7 | # The following defines the version and build number for your application.
8 | # A version number is three numbers separated by dots, like 1.2.43
9 | # followed by an optional build number separated by a +.
10 | # Both the version and the builder number may be overridden in flutter
11 | # build by specifying --build-name and --build-number, respectively.
12 | # In Android, build-name is used as versionName while build-number used as versionCode.
13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
15 | # Read more about iOS versioning at
16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17 | # In Windows, build-name is used as the major, minor, and patch parts
18 | # of the product and file versions while build-number is used as the build suffix.
19 | version: 1.0.0+1
20 |
21 | environment:
22 | sdk: '>=3.3.4 <4.0.0'
23 |
24 | # Dependencies specify other packages that your package needs in order to work.
25 | # To automatically upgrade your package dependencies to the latest versions
26 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
27 | # dependencies can be manually updated by changing the version numbers below to
28 | # the latest version available on pub.dev. To see which dependencies have newer
29 | # versions available, run `flutter pub outdated`.
30 | dependencies:
31 | candlesticks: ^2.1.0
32 | collection: ^1.18.0
33 | crypto_market: null
34 | cupertino_icons: ^1.0.6
35 | dio: ^5.4.3+1
36 | flutter:
37 | sdk: flutter
38 | flutter_hooks: ^0.20.5
39 | flutter_svg: null
40 | logger: ^2.3.0
41 | order_book: ^0.0.3
42 | stacked: ^3.4.2
43 | stacked_services: ^1.5.0
44 | uuid: ^4.4.0
45 | web_socket_channel: null
46 | web_socket_client: null
47 |
48 | dev_dependencies:
49 | build_runner: ^2.4.9
50 | flutter_lints: ^3.0.0
51 | flutter_test:
52 | sdk: flutter
53 | http_mock_adapter: ^0.6.1
54 | mocktail: ^1.0.3
55 | stacked_generator: ^1.6.0
56 |
57 | # For information on the generic Dart part of this file, see the
58 | # following page: https://dart.dev/tools/pub/pubspec
59 | # The following section is specific to Flutter packages.
60 | flutter:
61 |
62 | # The following line ensures that the Material Icons font is
63 | # included with your application, so that you can use the icons in
64 | # the material Icons class.
65 | uses-material-design: true
66 |
67 | # To add assets to your application, add an assets section, like this:
68 | assets:
69 | - assets/svgs/
70 | - assets/images/
71 | # An image asset can refer to one or more resolution-specific "variants", see
72 | # https://flutter.dev/assets-and-images/#resolution-aware
73 | # For details regarding adding assets from package dependencies, see
74 | # https://flutter.dev/assets-and-images/#from-packages
75 | # To add custom fonts to your application, add a fonts section here,
76 | # in this "flutter" section. Each entry in this list should have a
77 | # "family" key with the font family name, and a "fonts" key with a
78 | # list giving the asset and other descriptors for the font. For
79 | # example:
80 | # fonts:
81 | # - family: Schyler
82 | # fonts:
83 | # - asset: fonts/Schyler-Regular.ttf
84 | # - asset: fonts/Schyler-Italic.ttf
85 | # style: italic
86 | # - family: Trajan Pro
87 | # fonts:
88 | # - asset: fonts/TrajanPro.ttf
89 | # - asset: fonts/TrajanPro_Bold.ttf
90 | # weight: 700
91 | #
92 | # For details regarding fonts from package dependencies,
93 | # see https://flutter.dev/custom-fonts/#from-packages
94 |
--------------------------------------------------------------------------------
/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # Set fallback configurations for older versions of the flutter tool.
14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15 | set(FLUTTER_TARGET_PLATFORM "windows-x64")
16 | endif()
17 |
18 | # === Flutter Library ===
19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
20 |
21 | # Published to parent scope for install step.
22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
26 |
27 | list(APPEND FLUTTER_LIBRARY_HEADERS
28 | "flutter_export.h"
29 | "flutter_windows.h"
30 | "flutter_messenger.h"
31 | "flutter_plugin_registrar.h"
32 | "flutter_texture_registrar.h"
33 | )
34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
35 | add_library(flutter INTERFACE)
36 | target_include_directories(flutter INTERFACE
37 | "${EPHEMERAL_DIR}"
38 | )
39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
40 | add_dependencies(flutter flutter_assemble)
41 |
42 | # === Wrapper ===
43 | list(APPEND CPP_WRAPPER_SOURCES_CORE
44 | "core_implementations.cc"
45 | "standard_codec.cc"
46 | )
47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
49 | "plugin_registrar.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
52 | list(APPEND CPP_WRAPPER_SOURCES_APP
53 | "flutter_engine.cc"
54 | "flutter_view_controller.cc"
55 | )
56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
57 |
58 | # Wrapper sources needed for a plugin.
59 | add_library(flutter_wrapper_plugin STATIC
60 | ${CPP_WRAPPER_SOURCES_CORE}
61 | ${CPP_WRAPPER_SOURCES_PLUGIN}
62 | )
63 | apply_standard_settings(flutter_wrapper_plugin)
64 | set_target_properties(flutter_wrapper_plugin PROPERTIES
65 | POSITION_INDEPENDENT_CODE ON)
66 | set_target_properties(flutter_wrapper_plugin PROPERTIES
67 | CXX_VISIBILITY_PRESET hidden)
68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
69 | target_include_directories(flutter_wrapper_plugin PUBLIC
70 | "${WRAPPER_ROOT}/include"
71 | )
72 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
73 |
74 | # Wrapper sources needed for the runner.
75 | add_library(flutter_wrapper_app STATIC
76 | ${CPP_WRAPPER_SOURCES_CORE}
77 | ${CPP_WRAPPER_SOURCES_APP}
78 | )
79 | apply_standard_settings(flutter_wrapper_app)
80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
81 | target_include_directories(flutter_wrapper_app PUBLIC
82 | "${WRAPPER_ROOT}/include"
83 | )
84 | add_dependencies(flutter_wrapper_app flutter_assemble)
85 |
86 | # === Flutter tool backend ===
87 | # _phony_ is a non-existent file to force this command to run every time,
88 | # since currently there's no way to get a full input/output list from the
89 | # flutter tool.
90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
92 | add_custom_command(
93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
95 | ${CPP_WRAPPER_SOURCES_APP}
96 | ${PHONY_OUTPUT}
97 | COMMAND ${CMAKE_COMMAND} -E env
98 | ${FLUTTER_TOOL_ENVIRONMENT}
99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
100 | ${FLUTTER_TARGET_PLATFORM} $
101 | VERBATIM
102 | )
103 | add_custom_target(flutter_assemble DEPENDS
104 | "${FLUTTER_LIBRARY}"
105 | ${FLUTTER_LIBRARY_HEADERS}
106 | ${CPP_WRAPPER_SOURCES_CORE}
107 | ${CPP_WRAPPER_SOURCES_PLUGIN}
108 | ${CPP_WRAPPER_SOURCES_APP}
109 | )
110 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/home_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_svg/flutter_svg.dart';
3 | import 'package:stacked/stacked.dart';
4 |
5 | import '../../../core/_core.dart';
6 | import '../../../models/_models.dart';
7 | import '../../shared/_shared.dart';
8 | import 'home_viewmodel.dart';
9 | import 'widgets/orders_section.dart';
10 | import 'widgets/pop_menu.dart';
11 | import 'widgets/rates_section.dart';
12 | import 'widgets/ticker_section.dart';
13 |
14 | class HomeView extends StatelessWidget {
15 | const HomeView({super.key});
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | CandleData.fromJson(mockCandleData['data']?['k'] ?? {});
20 |
21 | final controller = OverlayPortalController();
22 | return ViewModelBuilder.reactive(
23 | viewModelBuilder: () => HomeViewModel(),
24 | onViewModelReady: (viewModel) => viewModel.init(),
25 | builder: (context, viewModel, child) {
26 | return Scaffold(
27 | appBar: AppBar(
28 | leadingWidth: 137,
29 | leading: Align(
30 | alignment: Alignment.centerRight,
31 | child: SvgPicture.asset(
32 | AppSvgAssets.companyLogo(context.cScheme.brightness.name),
33 | width: 121,
34 | ),
35 | ),
36 | actions: [
37 | IconButton(
38 | icon: Image.asset(AppImgAssets.profileImage, scale: 2),
39 | onPressed: () {},
40 | ),
41 | Spacing.horizTiny(),
42 | IconButton(
43 | icon: SvgPicture.asset(AppSvgAssets.globe),
44 | onPressed: () {},
45 | ),
46 | Spacing.horizTiny(),
47 | IconButton(
48 | icon: OverlayPortal(
49 | controller: controller,
50 | overlayChildBuilder: (context) =>
51 | PopMenu(controller: controller),
52 | child: SvgPicture.asset(AppSvgAssets.menu),
53 | ),
54 | onPressed: () => controller.toggle(),
55 | ),
56 | Spacing.horizRegular(),
57 | ],
58 | ),
59 | body: Builder(builder: (context) {
60 | if (viewModel.isBusy) {
61 | return const Center(child: CircularProgressIndicator());
62 | }
63 | return ListView(
64 | padding: const EdgeInsets.symmetric(vertical: 8),
65 | children: [
66 | Divider(thickness: 8, color: context.cScheme.secondary),
67 | const TickerSection(),
68 | Divider(thickness: 8, color: context.cScheme.secondary),
69 | Spacing.vertSmall(),
70 | const RatesSection(),
71 | Divider(thickness: 8, color: context.cScheme.secondary),
72 | Spacing.vertSmall(),
73 | const OrdersSection(),
74 | Spacing.vertLarge(),
75 | Divider(thickness: 48, color: context.cScheme.secondary),
76 | Container(
77 | padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
78 | child: Row(
79 | children: [
80 | Expanded(
81 | child: AppButton(
82 | label: 'Buy',
83 | onPressed: viewModel.openCreateOrderSheet,
84 | buttonColor: AppColors.green,
85 | labelColor: AppColors.white,
86 | ),
87 | ),
88 | Spacing.horizRegular(),
89 | Expanded(
90 | child: AppButton(
91 | label: 'Sell',
92 | onPressed: viewModel.openCreateOrderSheet,
93 | buttonColor: AppColors.red,
94 | labelColor: AppColors.white,
95 | ),
96 | ),
97 | ],
98 | ),
99 | ),
100 | Divider(thickness: 32, color: context.cScheme.secondary),
101 | ],
102 | );
103 | }),
104 | );
105 | },
106 | );
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(dao_preview LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "dao_preview")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(VERSION 3.14...3.25)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 |
56 | # Generated plugin build rules, which manage building the plugins and adding
57 | # them to the application.
58 | include(flutter/generated_plugins.cmake)
59 |
60 |
61 | # === Installation ===
62 | # Support files are copied into place next to the executable, so that it can
63 | # run in place. This is done instead of making a separate bundle (as on Linux)
64 | # so that building and running from within Visual Studio will work.
65 | set(BUILD_BUNDLE_DIR "$")
66 | # Make the "install" step default, as it's required to run.
67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
70 | endif()
71 |
72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
74 |
75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
76 | COMPONENT Runtime)
77 |
78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
79 | COMPONENT Runtime)
80 |
81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
82 | COMPONENT Runtime)
83 |
84 | if(PLUGIN_BUNDLED_LIBRARIES)
85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
87 | COMPONENT Runtime)
88 | endif()
89 |
90 | # Copy the native assets provided by the build.dart from all packages.
91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}"
93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
94 | COMPONENT Runtime)
95 |
96 | # Fully re-copy the assets directory on each build to avoid having stale files
97 | # from a previous install.
98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
99 | install(CODE "
100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
101 | " COMPONENT Runtime)
102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
104 |
105 | # Install the AOT library on non-Debug builds only.
106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
107 | CONFIGURATIONS Profile;Release
108 | COMPONENT Runtime)
109 |
--------------------------------------------------------------------------------
/lib/services/core_services/network_service/network_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:dio/dio.dart';
4 |
5 | import '../../../core/_core.dart';
6 | import '../../../models/_models.dart';
7 | import 'i_network_service.dart';
8 |
9 | class NetworkService extends INetworkService {
10 | final Dio _dio;
11 |
12 | NetworkService([Dio? dio]) : _dio = dio ?? _createDio();
13 |
14 | final _headers = {
15 | 'Accept': 'application/json',
16 | 'Content-Type': 'application/json',
17 | };
18 |
19 | static Dio _createDio() {
20 | return Dio()
21 | ..options.responseType = ResponseType.json
22 | ..httpClientAdapter
23 | ..options.headers = {
24 | 'Content-Type': 'application/json; charset=UTF-8',
25 | 'request-origin': 'mobile-app',
26 | 'Connection': 'keep-alive',
27 | }
28 | ..interceptors.addAll([
29 | NetworkLoggerInterceptor(),
30 | ]);
31 | }
32 |
33 | @override
34 | Future delete(String url,
35 | {dynamic body, Map? headers}) async {
36 | try {
37 | if (headers != null) {
38 | _headers.addAll(headers);
39 | }
40 | final res = await _dio.delete(
41 | url,
42 | data: body,
43 | options: Options(headers: _headers),
44 | );
45 | if (res.statusCode == 200 || res.statusCode == 201) {
46 | return res.data;
47 | }
48 | throw Failure(message: res.statusMessage!);
49 | } on DioException catch (e) {
50 | throw convertDioException(e);
51 | } catch (e) {
52 | throw FallbackFailure(message: e.toString());
53 | }
54 | }
55 |
56 | @override
57 | Future get(String url, {Map? headers}) async {
58 | try {
59 | if (headers != null) {
60 | _headers.addAll(headers);
61 | }
62 | final res = await _dio.get(
63 | url,
64 | options: Options(headers: _headers),
65 | );
66 | if (res.statusCode == 200 || res.statusCode == 201) {
67 | return res.data;
68 | }
69 | throw Failure(message: res.statusMessage!);
70 | } on DioException catch (e) {
71 | throw convertDioException(e);
72 | } catch (e) {
73 | throw FallbackFailure(message: e.toString());
74 | }
75 | }
76 |
77 | @override
78 | Future put(String url,
79 | {dynamic body, Map? headers}) async {
80 | try {
81 | if (headers != null) {
82 | _headers.addAll(headers);
83 | }
84 | final res = await _dio.put(
85 | url,
86 | data: body,
87 | options: Options(headers: _headers),
88 | );
89 | if (res.statusCode == 200 || res.statusCode == 201) {
90 | return res.data;
91 | }
92 | throw Failure(message: res.statusMessage!);
93 | } on DioException catch (e) {
94 | throw convertDioException(e);
95 | } catch (e) {
96 | throw FallbackFailure(message: e.toString());
97 | }
98 | }
99 |
100 | @override
101 | Future post(String url,
102 | {dynamic body, Map? headers}) async {
103 | try {
104 | if (headers != null) {
105 | _headers.addAll(headers);
106 | }
107 | final res = await _dio.post(
108 | url,
109 | data: body,
110 | options: Options(headers: _headers),
111 | );
112 | if (res.statusCode == 200 || res.statusCode == 201) {
113 | return res.data;
114 | }
115 | throw Failure(message: res.statusMessage!);
116 | } on DioException catch (e) {
117 | throw convertDioException(e);
118 | } catch (e) {
119 | throw FallbackFailure(message: e.toString());
120 | }
121 | }
122 |
123 | IFailure convertDioException(DioException e) {
124 | switch (e.type) {
125 | case DioExceptionType.connectionTimeout:
126 | case DioExceptionType.sendTimeout:
127 | case DioExceptionType.receiveTimeout:
128 | case DioExceptionType.connectionError:
129 | return InternetFailure(data: e);
130 | case DioExceptionType.badCertificate:
131 | case DioExceptionType.cancel:
132 | return Failure(
133 | message: e.response?.data['message'] ?? e.message ?? '',
134 | data: e.response?.data,
135 | );
136 | case DioExceptionType.unknown:
137 | if (e.error is SocketException) return InternetFailure(data: e);
138 | if (e.error is HandshakeException) return InternetFailure(data: e);
139 | return FallbackFailure(data: e);
140 | case DioExceptionType.badResponse:
141 | if ((e.response?.statusCode ?? 500) >= HttpStatus.internalServerError) {
142 | return ServerFailure(data: e.response?.data);
143 | }
144 | return Failure.fromHttpErrorMap(e.response?.data);
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "dao_preview");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "dao_preview");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GApplication::startup.
85 | static void my_application_startup(GApplication* application) {
86 | //MyApplication* self = MY_APPLICATION(object);
87 |
88 | // Perform any actions required at application startup.
89 |
90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
91 | }
92 |
93 | // Implements GApplication::shutdown.
94 | static void my_application_shutdown(GApplication* application) {
95 | //MyApplication* self = MY_APPLICATION(object);
96 |
97 | // Perform any actions required at application shutdown.
98 |
99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
100 | }
101 |
102 | // Implements GObject::dispose.
103 | static void my_application_dispose(GObject* object) {
104 | MyApplication* self = MY_APPLICATION(object);
105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
107 | }
108 |
109 | static void my_application_class_init(MyApplicationClass* klass) {
110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup;
113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
115 | }
116 |
117 | static void my_application_init(MyApplication* self) {}
118 |
119 | MyApplication* my_application_new() {
120 | return MY_APPLICATION(g_object_new(my_application_get_type(),
121 | "application-id", APPLICATION_ID,
122 | "flags", G_APPLICATION_NON_UNIQUE,
123 | nullptr));
124 | }
125 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/widgets/ticker_section.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_hooks/flutter_hooks.dart';
4 | import 'package:flutter_svg/flutter_svg.dart';
5 | import 'package:stacked/stacked.dart';
6 |
7 | import '../../../../core/_core.dart';
8 | import '../../../shared/_shared.dart';
9 | import '../home_viewmodel.dart';
10 |
11 | class TickerSection extends ViewModelWidget {
12 | const TickerSection({
13 | super.key,
14 | });
15 |
16 | @override
17 | Widget build(BuildContext context, HomeViewModel viewModel) {
18 | return HookBuilder(builder: (context) {
19 | final tickerData = useListenable(viewModel.tickerData).value;
20 | return Container(
21 | color: context.cScheme.background,
22 | padding: const EdgeInsets.symmetric(vertical: 16),
23 | child: Column(
24 | children: [
25 | Row(
26 | children: [
27 | Spacing.horizRegular(),
28 | SvgPicture.asset(AppSvgAssets.btcUsdt, height: 24),
29 | Spacing.horizSmall(),
30 | Text(
31 | viewModel.symbol,
32 | style: AppTextStyles.medium18.copyWith(
33 | color: context.cScheme.onBackground,
34 | ),
35 | ),
36 | Spacing.horizSmall(),
37 | const Icon(CupertinoIcons.chevron_down, size: 14),
38 | Spacing.horizLarge(),
39 | Text(
40 | '\$${tickerData?.lastPrice}',
41 | style: AppTextStyles.medium18.copyWith(
42 | color: AppColors.green,
43 | ),
44 | ),
45 | ],
46 | ),
47 | Spacing.vertRegular(),
48 | if (tickerData != null)
49 | SizedBox(
50 | height: 48,
51 | child: ListView(
52 | scrollDirection: Axis.horizontal,
53 | children: [
54 | ExchangeDetail(
55 | icon: Icons.access_time,
56 | title: '24h Change',
57 | value:
58 | '${tickerData.priceChange} ${tickerData.priceChangePercent}%',
59 | color: tickerData.priceChangePercent.isNegative
60 | ? AppColors.red
61 | : AppColors.green,
62 | ),
63 | const VerticalDivider(),
64 | ExchangeDetail(
65 | icon: CupertinoIcons.up_arrow,
66 | title: '24h high',
67 | value: '${tickerData.highPrice} +1.25%',
68 | ),
69 | const VerticalDivider(),
70 | ExchangeDetail(
71 | icon: CupertinoIcons.down_arrow,
72 | title: '24h low',
73 | value: '${tickerData.lowPrice} -1.25%',
74 | ),
75 | ],
76 | ),
77 | ),
78 | ],
79 | ),
80 | );
81 | });
82 | }
83 | }
84 |
85 | class ExchangeDetail extends StatelessWidget {
86 | final IconData icon;
87 | final String title;
88 | final String value;
89 | final Color? color;
90 | const ExchangeDetail({
91 | super.key,
92 | required this.icon,
93 | required this.title,
94 | required this.value,
95 | this.color,
96 | });
97 |
98 | @override
99 | Widget build(BuildContext context) {
100 | return Row(
101 | mainAxisSize: MainAxisSize.min,
102 | children: [
103 | Spacing.horizRegular(),
104 | Column(
105 | crossAxisAlignment: CrossAxisAlignment.start,
106 | children: [
107 | Row(
108 | crossAxisAlignment: CrossAxisAlignment.center,
109 | mainAxisAlignment: MainAxisAlignment.center,
110 | mainAxisSize: MainAxisSize.min,
111 | children: [
112 | Icon(
113 | icon,
114 | color: context.cScheme.onSecondary,
115 | size: 16,
116 | ),
117 | Spacing.horizTiny(),
118 | Text(
119 | title,
120 | style: AppTextStyles.medium12.copyWith(
121 | color: context.cScheme.onSecondary,
122 | ),
123 | ),
124 | ],
125 | ),
126 | Spacing.vertTiny(),
127 | Text(
128 | value,
129 | maxLines: 1,
130 | style: AppTextStyles.medium14.copyWith(
131 | color: color ?? context.cScheme.onBackground,
132 | ),
133 | ),
134 | ],
135 | ),
136 | Spacing.horizRegular(),
137 | ],
138 | );
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/lib/ui/views/home_view/widgets/rates_section.dart:
--------------------------------------------------------------------------------
1 | import 'package:candlesticks/candlesticks.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_svg/flutter_svg.dart';
4 | import 'package:stacked/stacked.dart';
5 |
6 | import '../../../../core/_core.dart';
7 | import '../../../shared/_shared.dart';
8 | import '../home_viewmodel.dart';
9 | import 'orderbook_section.dart';
10 |
11 | class RatesSection extends ViewModelWidget {
12 | const RatesSection({
13 | super.key,
14 | });
15 |
16 | @override
17 | Widget build(BuildContext context, HomeViewModel viewModel) {
18 | return Container(
19 | height: 450,
20 | color: context.cScheme.background,
21 | child: Column(
22 | children: [
23 | Container(
24 | margin: const EdgeInsets.symmetric(horizontal: 16),
25 | decoration: BoxDecoration(
26 | color: context.cScheme.secondary,
27 | borderRadius: BorderRadius.circular(8),
28 | ),
29 | height: 45,
30 | child: Row(
31 | children: MainViewEnum.values
32 | .map((filter) => Expanded(
33 | child: SectionItem(
34 | label: filter.value,
35 | isActive: viewModel.mainView == filter,
36 | onTap: () => viewModel.setMainView(filter),
37 | ),
38 | ))
39 | .toList(),
40 | ),
41 | ),
42 | Spacing.vertRegular(),
43 | Expanded(
44 | child: Container(
45 | height: 400,
46 | width: context.screenSize.width,
47 | color: context.cScheme.background,
48 | child: Builder(builder: (context) {
49 | if (viewModel.mainView == MainViewEnum.orderbook) {
50 | return const OrderbookSection();
51 | }
52 | return const ChartSection();
53 | }),
54 | ),
55 | ),
56 | ],
57 | ),
58 | );
59 | }
60 | }
61 |
62 | class ChartSection extends ViewModelWidget {
63 | const ChartSection({
64 | super.key,
65 | });
66 |
67 | @override
68 | Widget build(BuildContext context, HomeViewModel viewModel) {
69 | return Column(
70 | children: [
71 | SizedBox(
72 | height: 32,
73 | child: ListView(
74 | padding: const EdgeInsets.symmetric(horizontal: 16),
75 | scrollDirection: Axis.horizontal,
76 | children: [
77 | Center(
78 | child: Text(
79 | 'Time',
80 | style: AppTextStyles.medium14.copyWith(
81 | color: context.cScheme.onSecondary,
82 | ),
83 | ),
84 | ),
85 | Spacing.horizRegular(),
86 | ...ChartIntervalEnum.values.map(
87 | (filter) => GestureDetector(
88 | onTap: () => viewModel.setInterval(filter),
89 | child: Container(
90 | padding:
91 | const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
92 | decoration: BoxDecoration(
93 | color: viewModel.interval == filter
94 | ? context.cScheme.secondary
95 | : context.cScheme.background,
96 | borderRadius: BorderRadius.circular(8),
97 | ),
98 | child: Text(
99 | filter.name,
100 | style: AppTextStyles.medium14.copyWith(
101 | color: viewModel.interval == filter
102 | ? context.cScheme.onBackground
103 | : context.cScheme.onSecondary,
104 | ),
105 | ),
106 | ),
107 | ),
108 | ),
109 | Spacing.horizTiny(),
110 | const VerticalDivider(),
111 | Spacing.horizTiny(),
112 | SvgPicture.asset(AppSvgAssets.candleChart),
113 | Spacing.horizTiny(),
114 | const VerticalDivider(),
115 | Center(
116 | child: Text(
117 | 'Fx Indicators',
118 | style: AppTextStyles.medium14.copyWith(
119 | color: context.cScheme.onSecondary,
120 | ),
121 | ),
122 | ),
123 | ],
124 | ),
125 | ),
126 | Divider(thickness: 1, color: context.cScheme.secondary),
127 | Spacing.vertRegular(),
128 | Expanded(
129 | child: Candlesticks(
130 | candles: viewModel.candles.map((e) => e.toCandle()).toList(),
131 | ),
132 | ),
133 | ],
134 | );
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/lib/ui/shared/components/general/app_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../../../core/_core.dart';
4 | import '../../_shared.dart';
5 |
6 | class AppButton extends StatelessWidget {
7 | final String label;
8 | final VoidCallback? onPressed;
9 | final Color? labelColor, buttonColor;
10 | final Color? borderColor, disabledColor;
11 | final double? width, height, borderRadius, labelSize, elevation;
12 | final bool isCollapsed, isDisabled;
13 | final bool hasBorder, isBusy, showFeedback;
14 | final FontWeight? fontWeight;
15 | final EdgeInsetsGeometry? padding;
16 | final Widget? customChild, prefixWidget, suffixWidget;
17 |
18 | const AppButton({
19 | super.key,
20 | required this.label,
21 | this.onPressed,
22 | this.width,
23 | this.height,
24 | this.customChild,
25 | this.buttonColor,
26 | this.labelColor,
27 | this.disabledColor,
28 | this.borderColor,
29 | this.isCollapsed = false,
30 | this.isBusy = false,
31 | this.isDisabled = false,
32 | this.showFeedback = true,
33 | this.elevation = 0,
34 | this.fontWeight,
35 | this.borderRadius,
36 | this.padding,
37 | this.labelSize,
38 | this.prefixWidget,
39 | this.suffixWidget,
40 | }) : hasBorder = false;
41 |
42 | const AppButton.outline({
43 | super.key,
44 | required this.label,
45 | this.onPressed,
46 | this.width,
47 | this.height,
48 | this.customChild,
49 | this.buttonColor,
50 | this.labelColor,
51 | this.disabledColor,
52 | this.borderColor,
53 | this.isCollapsed = false,
54 | this.isBusy = false,
55 | this.isDisabled = false,
56 | this.showFeedback = true,
57 | this.elevation = 0,
58 | this.fontWeight,
59 | this.borderRadius,
60 | this.padding,
61 | this.labelSize,
62 | this.prefixWidget,
63 | this.suffixWidget,
64 | }) : hasBorder = true;
65 |
66 | @override
67 | Widget build(BuildContext context) {
68 | // final buttonColor = context.cScheme.brightness == Brightness.light
69 | // ? context.cScheme.onSurface
70 | // : context.cScheme.primary;
71 | return SizedBox(
72 | width: width ?? (isCollapsed ? null : double.maxFinite),
73 | height: height ?? (isCollapsed ? null : 32),
74 | child: MaterialButton(
75 | onPressed: isDisabled ? null : () => isBusy ? null : onPressed?.call(),
76 | disabledColor:
77 | disabledColor ?? context.cScheme.primary.withOpacity(0.3),
78 | color: buttonColor ?? context.cScheme.primary,
79 | elevation: elevation,
80 | clipBehavior: Clip.hardEdge,
81 | splashColor: showFeedback ? null : buttonColor,
82 | highlightColor: showFeedback ? null : buttonColor,
83 | highlightElevation: showFeedback ? 4 : 0,
84 | padding: padding ?? const EdgeInsets.all(5),
85 | shape: RoundedRectangleBorder(
86 | borderRadius: BorderRadius.circular(borderRadius ?? 8),
87 | side: hasBorder
88 | ? BorderSide(
89 | color: borderColor!.withOpacity(isDisabled ? 0.3 : 1),
90 | width: 1,
91 | )
92 | : BorderSide.none,
93 | ),
94 | child: Builder(
95 | builder: (context) {
96 | if (isBusy) {
97 | return SizedBox.square(
98 | child: FittedBox(
99 | child: AppLoader(
100 | padding: 10,
101 | color: labelColor ?? AppColors.white,
102 | ),
103 | ),
104 | );
105 | }
106 |
107 | if (customChild != null) return customChild!;
108 |
109 | return FittedBox(
110 | child: Row(
111 | children: [
112 | if (prefixWidget != null)
113 | Padding(
114 | padding: const EdgeInsets.only(right: 10),
115 | child: prefixWidget,
116 | ),
117 | Center(
118 | child: Text(
119 | label,
120 | textAlign: TextAlign.center,
121 | style: AppTextStyles.bold16.copyWith(
122 | color: labelColor ?? AppColors.white,
123 | ),
124 | ),
125 | ),
126 | if (suffixWidget != null)
127 | Padding(
128 | padding: const EdgeInsets.only(left: 10),
129 | child: suffixWidget,
130 | ),
131 | ],
132 | ),
133 | );
134 | },
135 | ),
136 | ),
137 | );
138 | }
139 | }
140 |
141 | class AppBackButton extends StatelessWidget {
142 | final Alignment? alignment;
143 | final VoidCallback? onPressed;
144 | const AppBackButton({
145 | super.key,
146 | this.alignment,
147 | this.onPressed,
148 | });
149 |
150 | @override
151 | Widget build(BuildContext context) {
152 | return IconButton(
153 | tooltip: 'Back',
154 | alignment: alignment ?? Alignment.centerLeft,
155 | onPressed: onPressed ?? Navigator.of(context).pop,
156 | padding: EdgeInsets.zero,
157 | icon: const Icon(
158 | Icons.arrow_back_ios_new_rounded,
159 | size: 14,
160 | ),
161 | );
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/lib/ui/shared/constants/app_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '_constants.dart';
4 |
5 | class AppTheme {
6 | AppTheme._();
7 |
8 | static final lightTheme = ThemeData(
9 | colorScheme: ColorScheme.fromSeed(
10 | seedColor: AppColors.lightPrimary,
11 | background: AppColors.lightBg,
12 | onBackground: AppColors.lightPrimary,
13 | surfaceTint: AppColors.transparent,
14 | secondary: AppColors.lightSecondary,
15 | onSecondary: AppColors.lightOnSecondary,
16 | primaryContainer: AppColors.lightActive,
17 | secondaryContainer: AppColors.lightActive2,
18 | ),
19 | fontFamily: AppTextStyles.lexend,
20 | useMaterial3: true,
21 | appBarTheme: const AppBarTheme(
22 | centerTitle: false,
23 | backgroundColor: AppColors.lightBg,
24 | elevation: 1,
25 | surfaceTintColor: AppColors.transparent,
26 | foregroundColor: AppColors.transparent,
27 | ),
28 | bottomSheetTheme: const BottomSheetThemeData(
29 | backgroundColor: AppColors.lightSheetBg,
30 | surfaceTintColor: AppColors.transparent,
31 | ),
32 | checkboxTheme: CheckboxThemeData(
33 | fillColor: MaterialStateColor.resolveWith((states) {
34 | if (states.contains(MaterialState.selected)) {
35 | return AppColors.green;
36 | }
37 | return AppColors.transparent;
38 | }),
39 | checkColor: MaterialStateProperty.all(AppColors.lightOnSecondary),
40 | visualDensity: VisualDensity.compact,
41 | shape: RoundedRectangleBorder(
42 | borderRadius: BorderRadius.circular(4),
43 | ),
44 | ),
45 | textTheme: textTheme,
46 | cardColor: AppColors.white,
47 | inputDecorationTheme: InputDecorationTheme(
48 | filled: false,
49 | hintStyle: AppTextStyles.medium12.copyWith(
50 | color: AppColors.lightOnSecondary,
51 | ),
52 | contentPadding: const EdgeInsets.fromLTRB(16, 13, 16, 13),
53 | border: OutlineInputBorder(
54 | borderRadius: BorderRadius.circular(8),
55 | borderSide: const BorderSide(color: AppColors.lightSecondary, width: 1),
56 | ),
57 | focusedBorder: OutlineInputBorder(
58 | borderRadius: BorderRadius.circular(8),
59 | borderSide: const BorderSide(color: AppColors.lightSecondary, width: 1),
60 | ),
61 | enabledBorder: OutlineInputBorder(
62 | borderRadius: BorderRadius.circular(8),
63 | borderSide: const BorderSide(color: AppColors.lightSecondary, width: 1),
64 | ),
65 | ),
66 | );
67 |
68 | static final darkTheme = ThemeData(
69 | colorScheme: ColorScheme.fromSeed(
70 | brightness: Brightness.dark,
71 | seedColor: AppColors.darkPrimary,
72 | background: AppColors.darkBg,
73 | onBackground: AppColors.darkPrimary,
74 | surfaceTint: AppColors.transparent,
75 | secondary: AppColors.darkSecondary,
76 | onSecondary: AppColors.darkOnSecondary,
77 | primaryContainer: AppColors.darkActive,
78 | secondaryContainer: AppColors.darkActive2,
79 | ),
80 | fontFamily: AppTextStyles.lexend,
81 | useMaterial3: true,
82 | appBarTheme: const AppBarTheme(
83 | centerTitle: false,
84 | backgroundColor: AppColors.darkBg,
85 | surfaceTintColor: AppColors.transparent,
86 | foregroundColor: AppColors.transparent,
87 | elevation: 1,
88 | ),
89 | bottomSheetTheme: const BottomSheetThemeData(
90 | backgroundColor: AppColors.darkSheetBg,
91 | surfaceTintColor: AppColors.transparent,
92 | ),
93 | cardColor: AppColors.darkSecondary,
94 | checkboxTheme: CheckboxThemeData(
95 | fillColor: MaterialStateColor.resolveWith((states) {
96 | if (states.contains(MaterialState.selected)) {
97 | return AppColors.green;
98 | }
99 | return AppColors.transparent;
100 | }),
101 | checkColor: MaterialStateProperty.all(AppColors.darkOnSecondary),
102 | visualDensity: VisualDensity.compact,
103 | shape: RoundedRectangleBorder(
104 | borderRadius: BorderRadius.circular(4),
105 | ),
106 | ),
107 | textTheme: textTheme,
108 | inputDecorationTheme: InputDecorationTheme(
109 | filled: false,
110 | hintStyle: AppTextStyles.medium12.copyWith(
111 | color: AppColors.darkOnSecondary,
112 | ),
113 | contentPadding: const EdgeInsets.fromLTRB(16, 13, 16, 13),
114 | border: OutlineInputBorder(
115 | borderRadius: BorderRadius.circular(8),
116 | borderSide:
117 | const BorderSide(color: AppColors.darkFieldBorder, width: 1),
118 | ),
119 | focusedBorder: OutlineInputBorder(
120 | borderRadius: BorderRadius.circular(8),
121 | borderSide:
122 | const BorderSide(color: AppColors.darkFieldBorder, width: 1),
123 | ),
124 | enabledBorder: OutlineInputBorder(
125 | borderRadius: BorderRadius.circular(8),
126 | borderSide:
127 | const BorderSide(color: AppColors.darkFieldBorder, width: 1),
128 | ),
129 | ),
130 | );
131 |
132 | static TextTheme get textTheme => const TextTheme(
133 | // displayLarge: AppTextStyles.bold32,
134 | // headlineLarge: AppTextStyles.bold18,
135 | // titleLarge: AppTextStyles.bold16,
136 | titleMedium: AppTextStyles.medium16,
137 | titleSmall: AppTextStyles.regular16,
138 | bodyLarge: AppTextStyles.bold14,
139 | bodySmall: AppTextStyles.regular14,
140 | labelSmall: AppTextStyles.regular12,
141 | );
142 | }
143 |
--------------------------------------------------------------------------------
/lib/core/app/app.logger.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // StackedLoggerGenerator
5 | // **************************************************************************
6 |
7 | // ignore_for_file: avoid_print, depend_on_referenced_packages
8 |
9 | /// Maybe this should be generated for the user as well?
10 | ///
11 | /// import 'package:customer_app/services/stackdriver/stackdriver_service.dart';
12 | import 'package:flutter/foundation.dart';
13 | import 'package:logger/logger.dart';
14 |
15 | class SimpleLogPrinter extends LogPrinter {
16 | final String className;
17 | final bool printCallingFunctionName;
18 | final bool printCallStack;
19 | final List exludeLogsFromClasses;
20 | final String? showOnlyClass;
21 |
22 | SimpleLogPrinter(
23 | this.className, {
24 | this.printCallingFunctionName = true,
25 | this.printCallStack = false,
26 | this.exludeLogsFromClasses = const [],
27 | this.showOnlyClass,
28 | });
29 |
30 | @override
31 | List log(LogEvent event) {
32 | var color = PrettyPrinter.defaultLevelColors[event.level];
33 | var emoji = PrettyPrinter.defaultLevelEmojis[event.level];
34 | var methodName = _getMethodName();
35 |
36 | var methodNameSection =
37 | printCallingFunctionName && methodName != null ? ' | $methodName' : '';
38 | var stackLog = event.stackTrace.toString();
39 | var output =
40 | '$emoji $className$methodNameSection - ${event.message}${event.error != null ? '\nERROR: ${event.error}\n' : ''}${printCallStack ? '\nSTACKTRACE:\n$stackLog' : ''}';
41 |
42 | if (exludeLogsFromClasses
43 | .any((excludeClass) => className == excludeClass) ||
44 | (showOnlyClass != null && className != showOnlyClass)) return [];
45 |
46 | final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
47 | List result = [];
48 |
49 | for (var line in output.split('\n')) {
50 | result.addAll(pattern.allMatches(line).map((match) {
51 | if (kReleaseMode) {
52 | return match.group(0)!;
53 | } else {
54 | return color!(match.group(0)!);
55 | }
56 | }));
57 | }
58 |
59 | return result;
60 | }
61 |
62 | String? _getMethodName() {
63 | try {
64 | final currentStack = StackTrace.current;
65 | final formattedStacktrace = _formatStackTrace(currentStack, 3);
66 | if (kIsWeb) {
67 | final classNameParts = _splitClassNameWords(className);
68 | return _findMostMatchedTrace(formattedStacktrace!, classNameParts)
69 | .split(' ')
70 | .last;
71 | } else {
72 | final realFirstLine = formattedStacktrace
73 | ?.firstWhere((line) => line.contains(className), orElse: () => "");
74 |
75 | final methodName = realFirstLine?.replaceAll('$className.', '');
76 | return methodName;
77 | }
78 | } catch (e) {
79 | // There's no deliberate function call from our code so we return null;
80 | return null;
81 | }
82 | }
83 |
84 | List _splitClassNameWords(String className) {
85 | return className
86 | .split(RegExp(r'(?=[A-Z])'))
87 | .map((e) => e.toLowerCase())
88 | .toList();
89 | }
90 |
91 | /// When the faulty word exists in the begging this method will not be very usefull
92 | String _findMostMatchedTrace(
93 | List stackTraces, List keyWords) {
94 | String match = stackTraces.firstWhere(
95 | (trace) => _doesTraceContainsAllKeywords(trace, keyWords),
96 | orElse: () => '');
97 | if (match.isEmpty) {
98 | match = _findMostMatchedTrace(
99 | stackTraces, keyWords.sublist(0, keyWords.length - 1));
100 | }
101 | return match;
102 | }
103 |
104 | bool _doesTraceContainsAllKeywords(String stackTrace, List keywords) {
105 | final formattedKeywordsAsRegex = RegExp(keywords.join('.*'));
106 | return stackTrace.contains(formattedKeywordsAsRegex);
107 | }
108 | }
109 |
110 | final stackTraceRegex = RegExp(r'#[0-9]+[\s]+(.+) \(([^\s]+)\)');
111 |
112 | List? _formatStackTrace(StackTrace stackTrace, int methodCount) {
113 | var lines = stackTrace.toString().split('\n');
114 |
115 | var formatted = [];
116 | var count = 0;
117 | for (var line in lines) {
118 | var match = stackTraceRegex.matchAsPrefix(line);
119 | if (match != null) {
120 | if (match.group(2)!.startsWith('package:logger')) {
121 | continue;
122 | }
123 | var newLine = ("${match.group(1)}");
124 | formatted.add(newLine.replaceAll('', '()'));
125 | if (++count == methodCount) {
126 | break;
127 | }
128 | } else {
129 | formatted.add(line);
130 | }
131 | }
132 |
133 | if (formatted.isEmpty) {
134 | return null;
135 | } else {
136 | return formatted;
137 | }
138 | }
139 |
140 | Logger getLogger(
141 | String className, {
142 | bool printCallingFunctionName = true,
143 | bool printCallstack = false,
144 | List exludeLogsFromClasses = const [],
145 | String? showOnlyClass,
146 | }) {
147 | return Logger(
148 | printer: SimpleLogPrinter(
149 | className,
150 | printCallingFunctionName: printCallingFunctionName,
151 | printCallStack: printCallstack,
152 | showOnlyClass: showOnlyClass,
153 | exludeLogsFromClasses: exludeLogsFromClasses,
154 | ),
155 | output: MultiOutput([
156 | if (!kReleaseMode) ConsoleOutput(),
157 | ]),
158 | );
159 | }
160 |
--------------------------------------------------------------------------------