Skip to content

Commit

Permalink
Merge pull request #2 from Codelessly/ray-nullsafety
Browse files Browse the repository at this point in the history
Null Safety Migration
  • Loading branch information
rayliverified authored Mar 15, 2021
2 parents bf702d6 + 5fe572e commit deac0dd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
23 changes: 12 additions & 11 deletions lib/components/blog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:minimal/routes.dart';
class ImageWrapper extends StatelessWidget {
final String image;

const ImageWrapper({Key key, this.image}) : super(key: key);
const ImageWrapper({Key? key, required this.image}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -31,7 +31,7 @@ class ImageWrapper extends StatelessWidget {
class TagWrapper extends StatelessWidget {
final List<Tag> tags;

const TagWrapper({Key key, this.tags}) : super(key: key);
const TagWrapper({Key? key, this.tags = const []}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -48,7 +48,7 @@ class TagWrapper extends StatelessWidget {
class Tag extends StatelessWidget {
final String tag;

const Tag({Key key, this.tag}) : super(key: key);
const Tag({Key? key, required this.tag}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -72,7 +72,7 @@ class Tag extends StatelessWidget {
class ReadMoreButton extends StatelessWidget {
final Function onPressed;

const ReadMoreButton({Key key, @required this.onPressed}) : super(key: key);
const ReadMoreButton({Key? key, required this.onPressed}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -83,7 +83,7 @@ class ReadMoreButton extends StatelessWidget {
onHover: (event) => setState(() => hover = true),
onExit: (event) => setState(() => hover = false),
child: OutlineButton(
onPressed: onPressed,
onPressed: onPressed as void Function()?,
highlightedBorderColor: textPrimary,
hoverColor: textPrimary,
borderSide: BorderSide(color: textPrimary, width: 2),
Expand Down Expand Up @@ -116,7 +116,8 @@ Widget dividerSmall = Container(
),
);

List<Widget> authorSection({String imageUrl, String name, String bio}) {
List<Widget> authorSection(
{required String imageUrl, String? name, String? bio}) {
return [
divider,
Container(
Expand Down Expand Up @@ -246,12 +247,12 @@ class Footer extends StatelessWidget {

class ListItem extends StatelessWidget {
// TODO replace with Post item model.
final String imageUrl;
final String title;
final String description;
final String? imageUrl;
final String? description;

const ListItem(
{Key key, this.imageUrl, @required this.title, this.description})
{Key? key, required this.title, this.imageUrl, this.description})
: super(key: key);

@override
Expand All @@ -261,7 +262,7 @@ class ListItem extends StatelessWidget {
if (imageUrl != null)
Container(
child: ImageWrapper(
image: imageUrl,
image: imageUrl!,
),
),
Align(
Expand All @@ -280,7 +281,7 @@ class ListItem extends StatelessWidget {
child: Container(
margin: marginBottom12,
child: Text(
description,
description!,
style: bodyTextStyle,
),
),
Expand Down
8 changes: 4 additions & 4 deletions lib/components/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:minimal/components/typography.dart';
class TextBody extends StatelessWidget {
final String text;

const TextBody({Key key, this.text}) : super(key: key);
const TextBody({Key? key, required this.text}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -22,7 +22,7 @@ class TextBody extends StatelessWidget {
class TextBodySecondary extends StatelessWidget {
final String text;

const TextBodySecondary({Key key, this.text}) : super(key: key);
const TextBodySecondary({Key? key, required this.text}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -39,7 +39,7 @@ class TextBodySecondary extends StatelessWidget {
class TextHeadlineSecondary extends StatelessWidget {
final String text;

const TextHeadlineSecondary({Key key, this.text}) : super(key: key);
const TextHeadlineSecondary({Key? key, required this.text}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -56,7 +56,7 @@ class TextHeadlineSecondary extends StatelessWidget {
class TextBlockquote extends StatelessWidget {
final String text;

const TextBlockquote({Key key, this.text}) : super(key: key);
const TextBlockquote({Key? key, required this.text}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, widget) => ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(context, widget),
BouncingScrollWrapper.builder(context, widget!),
maxWidth: 1200,
minWidth: 450,
defaultScale: true,
Expand All @@ -30,16 +30,12 @@ class MyApp extends StatelessWidget {
switch (settings.name) {
case Routes.home:
return ListPage();
break;
case Routes.post:
return PostPage();
break;
case Routes.style:
return TypographyPage();
break;
default:
return null;
break;
return SizedBox.shrink();
}
});
},
Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: minimal
description: A minimalistic Flutter website template for blogs and portfolios.
version: 1.0.3
version: 1.1.0

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand All @@ -15,13 +15,13 @@ dependencies:
# git:
# url: https://github.com/Codelessly/ResponsiveFramework.git
# ref: master
google_fonts: ^1.1.2
animations: ^1.1.2
google_fonts: ^2.0.0
animations: ^2.0.0

dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.8.1
flutter_launcher_icons: ^0.9.0

flutter_icons:
android: true
Expand Down

0 comments on commit deac0dd

Please sign in to comment.