Skip to content

Commit

Permalink
Changing Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Karan authored and Karan committed Apr 18, 2021
1 parent 68185e0 commit c60a2a9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 32 deletions.
24 changes: 16 additions & 8 deletions lib/Assesment/Forms/LivingArrangements/livingArrangementbase.dart
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import 'package:flutter/material.dart';
import 'package:tryapp/Assesment/Forms/LivingArrangements/livingArrangementUI.dart';
import 'package:tryapp/Assesment/Forms/Patio/patioUI.dart';

import 'package:provider/provider.dart';
import 'package:tryapp/Assesment/newassesment/newassesmentpro.dart';

import 'livingArrangementpro.dart';

class LivingArrangements extends StatelessWidget {
String roomname;
var accessname;
List<Map<String, dynamic>> wholelist;
LivingArrangements(this.roomname, this.wholelist, this.accessname);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ChangeNotifierProvider<NewAssesmentProvider>(
create: (_) => NewAssesmentProvider(""),
child: LivingArrangementsUI(roomname, wholelist, accessname)),
));
return MultiProvider(
providers: [
ChangeNotifierProvider<NewAssesmentProvider>(
create: (_) => NewAssesmentProvider("")),
ChangeNotifierProvider<LivingArrangementsProvider>(
create: (_) => LivingArrangementsProvider())
],
);
// return Scaffold(
// body: Center(
// child: ChangeNotifierProvider<NewAssesmentProvider>(
// create: (_) => NewAssesmentProvider(""),
// child: LivingArrangementsUI(roomname, wholelist, accessname)),
// ));
}
}
21 changes: 15 additions & 6 deletions lib/Assesment/Forms/LivingRoom/livingbase.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:tryapp/Assesment/newassesment/newassesmentpro.dart';
import './livingpro.dart';
import './livingui.dart';
import 'package:provider/provider.dart';
Expand All @@ -10,11 +11,19 @@ class LivingRoom extends StatelessWidget {
LivingRoom(this.roomname, this.wholelist, this.accessname);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ChangeNotifierProvider<LivingProvider>(
create: (_) => LivingProvider(),
child: LivingRoomUI(roomname, wholelist, accessname),
)));
return MultiProvider(
providers: [
ChangeNotifierProvider<NewAssesmentProvider>(
create: (_) => NewAssesmentProvider("")),
ChangeNotifierProvider<LivingProvider>(create: (_) => LivingProvider())
],
child: LivingRoomUI(roomname, wholelist, accessname));
);
// return Scaffold(
// body: Center(
// child: ChangeNotifierProvider<LivingProvider>(
// create: (_) => LivingProvider(),
// child: LivingRoomUI(roomname, wholelist, accessname),
// )));
}
}
71 changes: 53 additions & 18 deletions lib/Assesment/newassesment/cardsUI.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,66 @@ import 'package:tryapp/Assesment/Forms/Patio/patiobase.dart';
import 'package:async_button_builder/async_button_builder.dart';
import '../Forms/LivingRoom/livingbase.dart';


/// Frame of this page:
/// There are certain functions defined to take care of things such as colour and border dimension
/// of the linear progress bar
///
/// The main Build function:
///
/// *)The main Build function:
/// This fucntion contains following things:
/// --All this under a Stack so that the submit assessment button can staty in the bottom.
/// 1)Appbar
/// 2)Arrangements Card
/// a) Living Arrangements card(Mandatory). called the Cards fucntion described further in this doc.
/// 3) Available Rooms card:
/// 4)LISTVIEW to build the card based on number of rooms selected in last page(New Assessment Ui page).
///
///








///
///
/// Explanation: Innerlist:
///
/// {
/// 'name': 'Pathway',
/// 'count': text, //the count from button will get saved here
/// 'completed': 7,
/// 'rooms1':{<---------------------------------- (INNERLIST REFERS TO THIS LIST)
/// name:https://This will help us to
/// save name of room.
/// complete: //This will help
/// us to save the numbers of
/// completed fields this
/// far and also help us
/// to calculate the linear
/// progress bar.
/// total: // This is the total number
/// of questions in
/// particular rooms..
/// This is Static.
/// We will get this data
/// from gettotal function
/// from the provider.
/// question: { //this is explained in getMaps function in provider.
/// rr1:{
/// Answer:,
/// Priority:,
/// Recommendation:,
/// Recommendationthera:,
/// additional:{},
/// }
/// }
/// }
/// },
///
/// *)The Cards fucntion:
/// This fucntion takes(one room detail at a time called innerlist,index and key for individual card).
/// This function contains following things:
/// 1) The outer frame to display each and ever room details.
/// 2) The linear progress bar to show the completed fields in each and individual fields.
///
/// *) The getRoute class:
/// This fucntion takes (same innerlist,name of the room,the name of innerlist,index)
/// This function is a helper fucntion to the cards function.
/// It helps to decide which page ot which room to go.
///
///
final _colorgreen = Color.fromRGBO(10, 80, 106, 1);

Expand Down Expand Up @@ -106,7 +142,6 @@ class _CardsUINewState extends State<CardsUINew> with TickerProviderStateMixin {
}
}


/// This function will help us to get the colour base on the count of completed
/// form fields.
Color getcolor(innerlist, index) {
Expand All @@ -128,7 +163,6 @@ class _CardsUINewState extends State<CardsUINew> with TickerProviderStateMixin {
return colors;
}


/// This fucntion will help us to get border colour of our linear progress bar
Color getbordercolor(innerlist, index) {
Color bordercolor = Colors.red;
Expand All @@ -146,8 +180,7 @@ class _CardsUINewState extends State<CardsUINew> with TickerProviderStateMixin {
return bordercolor;
}


/// This will help us get border radius. this have been included because wehen the count
/// This will help us get border radius. this have been included because wehen the count
/// becomes equal to total question then th border radius changes.
BorderRadius getborderradius(innerlist, index) {
var bordertype = BorderRadius.only(
Expand Down Expand Up @@ -328,6 +361,7 @@ class _CardsUINewState extends State<CardsUINew> with TickerProviderStateMixin {
));
}

/// This is the card function used to dispaly the card.
Widget cards(Map<String, dynamic> innerlist, int index, key) {
return Container(
// width: double.infinity,
Expand Down Expand Up @@ -415,6 +449,7 @@ class _CardsUINewState extends State<CardsUINew> with TickerProviderStateMixin {
);
}

/// This function decides which page to visit base upon the name.
Widget getRoute(innerlist, roomname, accessname, index) {
if (innerlist['name'] == 'Living Room') {
Navigator.push(
Expand Down

0 comments on commit c60a2a9

Please sign in to comment.