Skip to content

Commit

Permalink
🔨 Added Null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
shashiben committed Oct 15, 2021
1 parent d21faba commit f7646e3
Show file tree
Hide file tree
Showing 58 changed files with 1,151 additions and 1,179 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Screen Name| Web | Mobile |
|:---:| :---: | :---: |
| Menu View | ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/menu_web.png)| ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/menu_mobile.png) |
| Home View | ![Home](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/home_web.png)| ![Home](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/home_mobile.png) |
| About View | ![About](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/menu_web.png)| ![About](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/about_mobile.png) |
| About View | ![About](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/about_web.png)| ![About](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/about_mobile.png) |
| Project View | ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/project_web.png)| ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/menu_mobile.png) |
| Experience View | ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/experience_web.png)| ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/experience_mobile.png) |
| Contact View | ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/web/contact_web.png)| ![Menu](https://raw.githubusercontent.com/shashiben/portfolio/master/screenshots/mobile/contact_mobile.png) |
Expand Down
11 changes: 11 additions & 0 deletions anaylsis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- "**/*.g.dart"

linter:
rules:
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_print
- prefer_single_quotes
8 changes: 4 additions & 4 deletions lib/app/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ mixin lightColor {
static Color textPrimaryColor = Color(0xFF31344B);
static Color textSecondaryColor = Color(0xFF44476A);

static Color dividerColor = Colors.grey[300];
static Color? dividerColor = Colors.grey[300];
}
mixin darkColor {
//** Theme Colors
static const primaryColor = Color(0xFF1EEBB3);
static const backgroundColor = Color(0xFF071D34);
static const surfaceColor = Color(0xFF112240);
static const primaryColor = Color(0xFFff9950);
static const backgroundColor = Color(0xFF050028);
static const surfaceColor = Color(0xFF1a163c);

//**Text Colors
static const Color textPrimaryColor = Color(0xFFCCD6F6);
Expand Down
328 changes: 164 additions & 164 deletions lib/app/configs.dart

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/app/locator.config.dart

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

1 change: 0 additions & 1 deletion lib/app/theme.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:portfolio/app/colors.dart';

Expand Down
18 changes: 8 additions & 10 deletions lib/core/models/project.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flutter/material.dart';

class Project {
final String githubLink;
final String websiteLink;
final String playstoreLink;
final String? githubLink;
final String? websiteLink;
final String? playstoreLink;
final String title;
final String description;
final List<String> tools;
Expand All @@ -14,9 +12,9 @@ class Project {
{this.githubLink,
this.websiteLink,
this.playstoreLink,
@required this.id,
@required this.type,
@required this.title,
@required this.description,
@required this.tools});
required this.id,
required this.type,
required this.title,
required this.description,
required this.tools});
}
6 changes: 3 additions & 3 deletions lib/core/models/skill_display.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/cupertino.dart';

class SkillDisplay {
final String title;
final IconData iconData;
final Color color;
final String? title;
final IconData? iconData;
final Color? color;

const SkillDisplay({this.title, this.iconData, this.color});
}
3 changes: 1 addition & 2 deletions lib/core/models/skill_model.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';

class SkillModel {
final String name;
final int percent;

SkillModel({@required this.name, @required this.percent});
SkillModel({required this.name, required this.percent});
}
2 changes: 1 addition & 1 deletion lib/core/models/technologies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ class Technologies {
final IconData icon;
final String name;

const Technologies({@required this.icon, @required this.name});
const Technologies({required this.icon, required this.name});
}
12 changes: 5 additions & 7 deletions lib/core/models/timeline_experience.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:flutter/material.dart';

class ExperienceTimeline {
final String title;
final String position;
Expand All @@ -8,9 +6,9 @@ class ExperienceTimeline {
final List<String> tools;

const ExperienceTimeline(
{@required this.title,
@required this.position,
@required this.timePeriod,
@required this.description,
@required this.tools});
{required this.title,
required this.position,
required this.timePeriod,
required this.description,
required this.tools});
}
69 changes: 34 additions & 35 deletions lib/core/utils/ScreenUiHelper.dart
Original file line number Diff line number Diff line change
@@ -1,67 +1,66 @@
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:portfolio/app/colors.dart';
import 'package:portfolio/app/configs.dart';
import 'package:portfolio/core/utils/scaling.dart';
import 'package:responsive_builder/responsive_builder.dart';

class ScreenUiHelper {
double width;
double height;
double? width;
double? height;

double blockSizeHorizontal;
double blockSizeVertical;
late double blockSizeHorizontal;
late double blockSizeVertical;

ScalingHelper scalingHelper;
ScalingHelper? scalingHelper;

TextStyle headline;
TextStyle title;
TextStyle body;
TextStyle buttonStyle;
TextStyle? headline;
TextStyle? title;
TextStyle? body;
TextStyle? buttonStyle;

double headlineSize;
double titleSize;
double bodySize;
double? headlineSize;
double? titleSize;
double? bodySize;

Color surfaceColor;
Color backgroundColor;
Color primaryColor;
Color textPrimaryColor;
Color textSecondaryColor;
Color dividerColor;
Color? surfaceColor;
Color? backgroundColor;
Color? primaryColor;
Color? textPrimaryColor;
Color? textSecondaryColor;
Color? dividerColor;

NeumorphicTextStyle headlineTextStyle;
NeumorphicTextStyle titleTextStyle;
NeumorphicTextStyle bodyTextStyle;
NeumorphicTextStyle buttonTextStyle;
NeumorphicTextStyle? headlineTextStyle;
late NeumorphicTextStyle titleTextStyle;
NeumorphicTextStyle? bodyTextStyle;
NeumorphicTextStyle? buttonTextStyle;

SizedBox verticalSpaceLow;
SizedBox verticalSpaceMedium;
SizedBox verticalSpaceHigh;
late SizedBox verticalSpaceLow;
late SizedBox verticalSpaceMedium;
late SizedBox verticalSpaceHigh;

SizedBox horizontalSpaceLow;
SizedBox horizontalSpaceMedium;
SizedBox horizontalSpaceHigh;
SizedBox? horizontalSpaceLow;
SizedBox? horizontalSpaceMedium;
SizedBox? horizontalSpaceHigh;

ScreenUiHelper.fromContext(BuildContext context) {
var mediaQuery = MediaQuery.of(context);

surfaceColor = NeumorphicTheme.of(context).isUsingDark
surfaceColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.surfaceColor
: lightColor.surfaceColor;
backgroundColor = NeumorphicTheme.of(context).isUsingDark
backgroundColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.backgroundColor
: lightColor.backgroundColor;
primaryColor = NeumorphicTheme.of(context).isUsingDark
primaryColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.primaryColor
: lightColor.primaryColor;
textPrimaryColor = NeumorphicTheme.of(context).isUsingDark
textPrimaryColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.textPrimaryColor
: lightColor.textPrimaryColor;
textSecondaryColor = NeumorphicTheme.of(context).isUsingDark
textSecondaryColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.textSecondaryColor
: lightColor.textSecondaryColor;
dividerColor = NeumorphicTheme.of(context).isUsingDark
dividerColor = NeumorphicTheme.of(context)!.isUsingDark
? darkColor.dividerColor
: lightColor.dividerColor;

Expand Down
10 changes: 5 additions & 5 deletions lib/core/utils/adaptive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ enum DisplayType {

DeviceScreenType getDeviceType(
Size size, [
ScreenBreakpoints breakpoint,
ScreenBreakpoints? breakpoint,
]) {
double deviceWidth = size.shortestSide;

Expand Down Expand Up @@ -96,8 +96,8 @@ double heightOfScreen(BuildContext context) {
}

double assignHeight({
@required BuildContext context,
@required double fraction,
required BuildContext context,
required double fraction,
double additions = 0,
double subs = 0,
}) {
Expand All @@ -106,8 +106,8 @@ double assignHeight({

//
double assignWidth({
@required BuildContext context,
@required double fraction,
required BuildContext context,
required double fraction,
double additions = 0,
double subs = 0,
}) {
Expand Down
16 changes: 8 additions & 8 deletions lib/core/utils/architecture_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'ScreenUiHelper.dart';
class ScreenBuilder<T extends BaseViewModel> extends StatelessWidget {
final bool disposeViewModel;
final bool isReactive;
final Widget Function(BuildContext, ScreenUiHelper, T) builder;
final T viewModel;
final Function(T) onModelReady;
final Widget Function(BuildContext, ScreenUiHelper, T)? builder;
final T? viewModel;
final Function(T)? onModelReady;

ScreenBuilder(
{Key key,
{Key? key,
this.builder,
this.viewModel,
this.disposeViewModel = true,
Expand All @@ -27,19 +27,19 @@ class ScreenBuilder<T extends BaseViewModel> extends StatelessWidget {
return ViewModelBuilder<T>.reactive(
disposeViewModel: disposeViewModel,
onModelReady: onModelReady ?? null,
viewModelBuilder: () => viewModel,
viewModelBuilder: () => viewModel!,
builder: (context, model, child) => SafeArea(
child: Scaffold(
backgroundColor: uiHelpers.backgroundColor,
body: builder(context, uiHelpers, model)),
body: builder!(context, uiHelpers, model)),
));
} else {
return ViewModelBuilder<T>.nonReactive(
builder: (context, model, child) =>
SafeArea(child: builder(context, uiHelpers, model)),
SafeArea(child: builder!(context, uiHelpers, model)),
disposeViewModel: disposeViewModel,
onModelReady: onModelReady ?? null,
viewModelBuilder: () => viewModel);
viewModelBuilder: () => viewModel!);
}
}
}
Loading

0 comments on commit f7646e3

Please sign in to comment.