Skip to content

Commit

Permalink
Migrate to dart 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlphamerc committed Apr 14, 2024
1 parent 4d318af commit 432e4d3
Show file tree
Hide file tree
Showing 17 changed files with 366 additions and 297 deletions.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>12.0</string>
</dict>
</plist>
16 changes: 8 additions & 8 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -135,7 +135,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -179,10 +179,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -193,6 +195,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -241,7 +244,6 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -281,7 +283,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -318,7 +320,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -364,7 +365,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -374,7 +375,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -414,7 +414,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
9 changes: 6 additions & 3 deletions lib/src/config/route.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_healthcare_app/src/model/dactor_model.dart';
import 'package:flutter_healthcare_app/src/pages/detail_page.dart';
import 'package:flutter_healthcare_app/src/pages/home_page.dart';
import 'package:flutter_healthcare_app/src/pages/splash_page.dart';
Expand All @@ -12,15 +13,17 @@ class Routes {
};
}

static Route onGenerateRoute(RouteSettings settings) {
final List<String> pathElements = settings.name.split('/');
static Route? onGenerateRoute(RouteSettings settings) {
final List<String> pathElements = settings.name?.split('/') ?? [];
if (pathElements[0] != '' || pathElements.length == 1) {
return null;
}
switch (pathElements[1]) {
case "DetailPage":
return CustomRoute<bool>(
builder: (BuildContext context) => DetailPage(model: settings.arguments,));
builder: (BuildContext context) =>
DetailPage(model: settings.arguments as DoctorModel),
);
}
}
}
107 changes: 56 additions & 51 deletions lib/src/model/dactor_model.dart
Original file line number Diff line number Diff line change
@@ -1,68 +1,73 @@
import 'dart:convert';

class DoctorModel {
String name;
String type;
String description;
double rating;
double goodReviews;
double totalScore;
double satisfaction;
bool isfavourite;
String image;
String name;
String type;
String description;
double rating;
double goodReviews;
double totalScore;
double satisfaction;
bool isfavourite;
String image;

DoctorModel({
this.name,
this.type,
this.description,
this.rating,
this.goodReviews,
this.totalScore,
this.satisfaction,
this.isfavourite,
this.image,
});
DoctorModel({
required this.name,
required this.type,
required this.description,
required this.rating,
required this.goodReviews,
required this.totalScore,
required this.satisfaction,
required this.isfavourite,
required this.image,
});

DoctorModel copyWith({
String name,
String type,
String description,
double rating,
double goodReviews,
double totalScore,
double satisfaction,
bool isfavourite,
String image,
}) =>
DoctorModel(
name: name ?? this.name,
type: type ?? this.type,
description: description ?? this.description,
rating: rating ?? this.rating,
goodReviews: goodReviews ?? this.goodReviews,
totalScore: totalScore ?? this.totalScore,
satisfaction: satisfaction ?? this.satisfaction,
isfavourite: isfavourite ?? this.isfavourite,
image: image ?? this.image,
);
DoctorModel copyWith({
String? name,
String? type,
String? description,
double? rating,
double? goodReviews,
double? totalScore,
double? satisfaction,
bool? isfavourite,
String? image,
}) =>
DoctorModel(
name: name ?? this.name,
type: type ?? this.type,
description: description ?? this.description,
rating: rating ?? this.rating,
goodReviews: goodReviews ?? this.goodReviews,
totalScore: totalScore ?? this.totalScore,
satisfaction: satisfaction ?? this.satisfaction,
isfavourite: isfavourite ?? this.isfavourite,
image: image ?? this.image,
);

factory DoctorModel.fromRawJson(String str) => DoctorModel.fromJson(json.decode(str));
factory DoctorModel.fromRawJson(String str) =>
DoctorModel.fromJson(json.decode(str));

String toRawJson() => json.encode(toJson());
String toRawJson() => json.encode(toJson());

factory DoctorModel.fromJson(Map<String, dynamic> json) => DoctorModel(
factory DoctorModel.fromJson(Map<String, dynamic> json) => DoctorModel(
name: json["name"] == null ? null : json["name"],
type: json["type"] == null ? null : json["type"],
description: json["description"] == null ? null : json["description"],
rating: json["rating"] == null ? null : json["rating"].toDouble(),
goodReviews: json["goodReviews"] == null ? null : json["goodReviews"].toDouble(),
totalScore: json["totalScore"] == null ? null : json["totalScore"].toDouble(),
satisfaction: json["satisfaction"] == null ? null : json["satisfaction"].toDouble(),
goodReviews:
json["goodReviews"] == null ? null : json["goodReviews"].toDouble(),
totalScore:
json["totalScore"] == null ? null : json["totalScore"].toDouble(),
satisfaction: json["satisfaction"] == null
? null
: json["satisfaction"].toDouble(),
isfavourite: json["isfavourite"] == null ? null : json["isfavourite"],
image: json["image"] == null ? null : json["image"],
);
);

Map<String, dynamic> toJson() => {
Map<String, dynamic> toJson() => {
"name": name == null ? null : name,
"type": type == null ? null : type,
"description": description == null ? null : description,
Expand All @@ -72,5 +77,5 @@ class DoctorModel {
"satisfaction": satisfaction == null ? null : satisfaction,
"isfavourite": isfavourite == null ? null : isfavourite,
"image": image == null ? null : image,
};
};
}
51 changes: 35 additions & 16 deletions lib/src/pages/detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'package:flutter_healthcare_app/src/widgets/progress_widget.dart';
import 'package:flutter_healthcare_app/src/widgets/rating_start.dart';

class DetailPage extends StatefulWidget {
DetailPage({Key key, this.model}) : super(key: key);
DetailPage({required this.model});
final DoctorModel model;

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

class _DetailPageState extends State<DetailPage> {
DoctorModel model;
late DoctorModel model;
@override
void initState() {
model = widget.model;
Expand Down Expand Up @@ -62,7 +62,10 @@ class _DetailPageState extends State<DetailPage> {
builder: (context, scrollController) {
return Container(
height: AppTheme.fullHeight(context) * .5,
padding: EdgeInsets.only(left:19,right:19,top: 16),//symmetric(horizontal: 19, vertical: 16),
padding: EdgeInsets.only(
left: 19,
right: 19,
top: 16), //symmetric(horizontal: 19, vertical: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
Expand Down Expand Up @@ -149,33 +152,49 @@ class _DetailPageState extends State<DetailPage> {
height: 45,
width: 45,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: LightColor.grey.withAlpha(150)
borderRadius: BorderRadius.circular(10),
color: LightColor.grey.withAlpha(150)),
child: Icon(
Icons.call,
color: Colors.white,
),
child: Icon(Icons.call, color: Colors.white,),
).ripple((){}, borderRadius:BorderRadius.circular(10), ),
).ripple(
() {},
borderRadius: BorderRadius.circular(10),
),
SizedBox(
width: 10,
),
Container(
height: 45,
width: 45,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: LightColor.grey.withAlpha(150)
borderRadius: BorderRadius.circular(10),
color: LightColor.grey.withAlpha(150)),
child: Icon(
Icons.chat_bubble,
color: Colors.white,
),
child: Icon(Icons.chat_bubble, color: Colors.white,),
).ripple((){}, borderRadius:BorderRadius.circular(10), ),
).ripple(
() {},
borderRadius: BorderRadius.circular(10),
),
SizedBox(
width: 10,
),
FlatButton(
color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: LightColor.purple,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
textStyle: TextStyles.bodySm,
),
onPressed: () {},
child: Text("Make an appointment", style: TextStyles.titleNormal.white,).p(10),
child: Text(
"Make an appointment",
style: TextStyles.titleNormal.white,
).p(10),
),
],
).vP16
Expand Down
Loading

0 comments on commit 432e4d3

Please sign in to comment.