Skip to content

Commit

Permalink
Merge pull request #11 from aman-singh7/app
Browse files Browse the repository at this point in the history
feat: add date
  • Loading branch information
DelunRex committed Sep 26, 2021
2 parents 32c382b + 1eb76a6 commit aa2ff01
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/locator.dart
Expand Up @@ -2,6 +2,7 @@ import 'package:borderhacks_client/services/firebase_auth_service.dart';
import 'package:borderhacks_client/services/local_storage_service.dart';
import 'package:borderhacks_client/viewmodels/landing_viewmodel.dart';
import 'package:borderhacks_client/viewmodels/auth_viewmodel.dart';
import 'package:borderhacks_client/viewmodels/myappointment_viewmodel.dart';
import 'package:borderhacks_client/viewmodels/startup_viewmodel.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
Expand All @@ -21,4 +22,5 @@ Future<void> setupLocator() async {
locator.registerFactory(() => StartUpViewModel());
locator.registerFactory(() => AuthViewModel());
locator.registerFactory(() => LandingViewModel());
locator.registerFactory(() => MyAppointmentViewModel());
}
11 changes: 11 additions & 0 deletions lib/models/patient_model.dart
@@ -0,0 +1,11 @@
class Patient {
String appointmentDate, clinicAddress, doctorName, patientName, patientAge;

Patient({
required this.appointmentDate,
required this.clinicAddress,
required this.doctorName,
required this.patientName,
required this.patientAge,
});
}
78 changes: 78 additions & 0 deletions lib/ui/components/appointments_tile.dart
@@ -0,0 +1,78 @@
import 'package:borderhacks_client/app_theme.dart';
import 'package:borderhacks_client/models/patient_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AppointmentTile extends StatelessWidget {
final Patient patient;

const AppointmentTile(this.patient, {Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Card(
color: AppTheme.white,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 8.w,
vertical: 8.h,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
patient.patientName,
style: AppTheme.h3.copyWith(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
color: AppTheme.darkerBlue,
),
),
Text(
patient.patientAge,
style: AppTheme.h3.copyWith(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
color: AppTheme.darkerBlue,
),
),
Text(
patient.appointmentDate,
style: AppTheme.h3.copyWith(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
color: AppTheme.darkerBlue,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
patient.doctorName,
style: AppTheme.h3.copyWith(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
color: AppTheme.darkerBlue,
),
),
Text(
patient.clinicAddress,
style: AppTheme.h3.copyWith(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500,
color: AppTheme.darkerBlue,
),
),
],
),
],
),
),
);
}
}
35 changes: 33 additions & 2 deletions lib/ui/view/myappointment_view.dart
@@ -1,10 +1,41 @@
import 'base_view.dart';
import 'package:borderhacks_client/ui/components/appointments_tile.dart';
import 'package:borderhacks_client/viewmodels/myappointment_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

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

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

class _MyAppointmentViewState extends State<MyAppointmentView> {
@override
Widget build(BuildContext context) {
return Container();
return BaseView<MyAppointmentViewModel>(builder: (context, model, child) {
return Scaffold(
body: _buildBody(model),
);
});
}

Widget _buildBody(MyAppointmentViewModel model) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.h),
child: Column(
children: [
ListView(
shrinkWrap: true,
padding: EdgeInsets.symmetric(vertical: 8.h),
children: List<Widget>.generate(
2,
(_) => AppointmentTile(model.getDummyData()),
),
),
],
),
);
}
}
14 changes: 14 additions & 0 deletions lib/viewmodels/myappointment_viewmodel.dart
@@ -0,0 +1,14 @@
import 'package:borderhacks_client/models/patient_model.dart';
import 'package:borderhacks_client/viewmodels/base_viewmodel.dart';

class MyAppointmentViewModel extends BaseViewModel {
Patient getDummyData() {
return Patient(
appointmentDate: '29/09/2021',
clinicAddress: '25/30 Awas Vikas',
doctorName: 'Dr Vinay Singh',
patientName: 'DelunRex',
patientAge: '19',
);
}
}

0 comments on commit aa2ff01

Please sign in to comment.