Skip to content

Commit

Permalink
feat: create ui for survey detail (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
markgravity committed May 13, 2021
1 parent 315ed8d commit f65a8e3
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 9 deletions.
3 changes: 2 additions & 1 deletion assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"loginScreenEmailTextFieldPlaceholderText": "Email",
"loginScreenPasswordTextFieldPlaceholderText": "Password",
"homeScreenTodayText": "Today",
"sideMenuLogoutButtonTitle": "Logout"
"sideMenuLogoutButtonTitle": "Logout",
"surveyDetailScreenStartSurveyButtonTitle": "Start Survey"
}
3 changes: 2 additions & 1 deletion assets/l10n/app_vi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"loginScreenEmailTextFieldPlaceholderText": "Email",
"loginScreenPasswordTextFieldPlaceholderText": "Mật khẩu",
"homeScreenTodayText": "Hôm nay",
"sideMenuLogoutButtonTitle": "Đăng xuất"
"sideMenuLogoutButtonTitle": "Đăng xuất",
"surveyDetailScreenStartSurveyButtonTitle": "Bắt đầu khảm sát"
}
67 changes: 67 additions & 0 deletions lib/modules/survey_detail/components/content.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
part of '../survey_detail_module.dart';

class Content extends StatelessWidget {
const Content({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Screen(
body: Stack(
fit: StackFit.expand,
children: [
Image(
image: Assets.images.mainBackgroundDimmed,
fit: BoxFit.fill,
),
SafeArea(
child: Column(
children: [
NavigationBar(),
Expanded(
child: Container(
margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Column(
children: [
const Text(
"Working from home Check-In",
style: TextStyle(
color: Colors.white,
fontSize: 34,
),
),
const SizedBox(
height: 17,
),
Text(
"We would like to know how you feel about our work from home (WFH) experience.",
style: TextStyle(
color: Colors.white.withOpacity(0.7),
fontSize: 17,
),
),
Expanded(child: Container()),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ConstrainedBox(
constraints: const BoxConstraints(
minWidth: 140,
),
child: Button(
title: AppLocalizations.of(context)!
.surveyDetailScreenStartSurveyButtonTitle,
),
),
]),
],
),
),
),
],
),
),
],
),
);
}
}
8 changes: 8 additions & 0 deletions lib/modules/survey_detail/survey_detail_interactor.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
part of 'survey_detail_module.dart';

abstract class SurveyDetailInteractorDelegate {}

abstract class SurveyDetailInteractor
extends Interactor<SurveyDetailInteractorDelegate> {}

class SurveyDetailInteractorImpl extends SurveyDetailInteractor {}
26 changes: 19 additions & 7 deletions lib/modules/survey_detail/survey_detail_module.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart' hide Router;
import 'package:flutter/widgets.dart' hide Router;
import 'package:survey/components/button/button.dart';
import 'package:survey/components/navigation_bar/navigation_bar.dart';
import 'package:survey/core/viper/module.dart';
import 'package:survey/gen/assets.gen.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:survey/modules/screen.dart';

class SurveyDetailModule extends Module {
part 'survey_detail_view.dart';

part 'survey_detail_interactor.dart';

part 'survey_detail_presenter.dart';

part 'survey_detail_router.dart';

part 'components/content.dart';

class SurveyDetailModule extends Module<SurveyDetailView,
SurveyDetailInteractor, SurveyDetailPresenter, SurveyDetailRouter> {
static const routePath = "/survey/detail";

@override
Widget build(BuildContext context) {
return const Screen(
body: Center(
child: Text("Survey Detail"),
),
);
return const SurveyDetailViewImpl();
}
}
7 changes: 7 additions & 0 deletions lib/modules/survey_detail/survey_detail_presenter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
part of 'survey_detail_module.dart';

abstract class SurveyDetailPresenter extends Presenter<SurveyDetailView,
SurveyDetailInteractor, SurveyDetailRouter> {}

class SurveyDetailPresenterImpl extends SurveyDetailPresenter
implements SurveyDetailViewDelegate, SurveyDetailInteractorDelegate {}
5 changes: 5 additions & 0 deletions lib/modules/survey_detail/survey_detail_router.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
part of 'survey_detail_module.dart';

abstract class SurveyDetailRouter extends Router {}

class SurveyDetailRouterImpl extends SurveyDetailRouter {}
20 changes: 20 additions & 0 deletions lib/modules/survey_detail/survey_detail_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
part of 'survey_detail_module.dart';

abstract class SurveyDetailViewDelegate {}

abstract class SurveyDetailView extends View<SurveyDetailViewDelegate> {}

class SurveyDetailViewImpl extends StatefulWidget {
const SurveyDetailViewImpl({Key? key}) : super(key: key);

@override
_SurveyDetailViewImplState createState() => _SurveyDetailViewImplState();
}

class _SurveyDetailViewImplState extends ViewState<SurveyDetailViewImpl,
SurveyDetailModule, SurveyDetailViewDelegate> implements SurveyDetailView {
@override
Widget build(BuildContext context) {
return const Content();
}
}
1 change: 1 addition & 0 deletions lib/services/locator/locator_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:survey/modules/home/home_module.dart';
import 'package:survey/modules/landing/landing_module.dart';
import 'package:survey/modules/login/login_module.dart';
import 'package:survey/modules/side_menu/side_menu_module.dart';
import 'package:survey/modules/survey_detail/survey_detail_module.dart';
import 'package:survey/repositories/survey_repository.dart';
import 'package:survey/services/api/api_service.dart';
import 'package:survey/services/api/auth/auth_api_service.dart';
Expand Down
7 changes: 7 additions & 0 deletions lib/services/locator/locator_service_register.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,12 @@ class LocatorServiceRegister {
locator.registerFactory<SideMenuInteractor>(() => SideMenuInteractorImpl());
locator.registerFactory<SideMenuRouter>(() => SideMenuRouterImpl());
locator.registerFactory<SideMenuPresenter>(() => SideMenuPresenterImpl());

// Survey Detail
locator.registerFactory<SurveyDetailInteractor>(
() => SurveyDetailInteractorImpl());
locator.registerFactory<SurveyDetailRouter>(() => SurveyDetailRouterImpl());
locator.registerFactory<SurveyDetailPresenter>(
() => SurveyDetailPresenterImpl());
}
}

0 comments on commit f65a8e3

Please sign in to comment.