Cashir 测验
这是来自 cashir.app 的面试挑战的解决方案。在此挑战中,我需要设计一个调查应用程序来收集用户数据,我需要获取用户响应并将它们本地持久化。我还需要获取并显示已提交的响应。
关于 Cashir
永远不用担心现金不足。使用 Cashir,您可以无需前往银行即可提取现金,这只是成为银行的众多好处之一。
免费获取现金或转账,无需排队等待银行服务。
- 现金提款
- 现金存款
- 现金转账
- 获取贷款
- 管理交易
- 安全交易
Flutter
Flutter 是 Google 的开源框架,用于使用单一代码库构建美观、原生编译的多平台应用程序。
本项目使用 flutter 构建。
要检查您是否安装了 flutter,请运行
flutter doctor
如果您尚未安装和设置 flutter,请按照此步骤操作:如何设置 Flutter
如何使用
步骤 1
使用下面的链接下载或克隆此仓库
https://github.com/JustineUgo/cashir_quiz.git
步骤 2
转到项目根目录,在控制台中执行以下命令以获取所需的依赖项
flutter pub get
步骤 3
连接您的手机或模拟器并运行此命令
flutter run
模块
- 首页
- 历史记录 – 查看过去回答的测验以及得分
- 问题 – 涵盖了测验的生成
详情
- 框架:Flutter > 2.5 兼容空安全
- 架构模式:MVC (Model-View-Controller)
- 存储 (本地):GetStorage
- 状态管理:GetX
- API:https://opentdb.com/api.php?amount=10&category=28&type=multiple
文件夹结构
这是 Flutter 提供的核心文件夹结构。
flutter-app/
|- android
|- assets
|- build
|- ios
|- lib
|- test
|- web
这是我们在此项目中使用的文件夹结构
lib/app
|- data/
|- modules/
|- routes.dart
现在,让我们深入 `lib` 文件夹,其中包含应用程序的主要代码。
1- constants - All the application level constants are defined in this directory with-in their respective files. This directory contains the constants for `theme`, `api endpoints`, `preferences` etc.
2- modules - Contains the 3 different modules of the app.
3 - routes.dart — This file contains all the routes for your application.
常量
此目录包含所有应用程序级别的常量。如下面的示例所示,为每种类型创建一个单独的文件
constants/
|- alerts.dart
|- end_points.dart
|- images.dart
|- stylings.dart
模块
包含应用程序的3个不同模块。
modules/
|- history/
|- home/
|- questions
每个模块中包含的文件夹
controllers - this is where the logic of the app is written.
views - contains the ui of the module.
providers — contains the network calls.
models - contains the application's dynamic data structure
Routes
此文件包含您应用程序的所有路由。
routes/
|- app_pages.dart
|- app_routes.dart
Main
这是应用程序的起点。所有应用程序级别的配置都在此文件中定义,即主题、路由、标题、方向等。
结论
我很乐意回答您关于此项目的任何问题。?
如果您喜欢我的工作,请不要忘记 ⭐ 收藏此仓库。
