From 44930c690fd24871d880b5d8caa81410ed342e2b Mon Sep 17 00:00:00 2001 From: Ray Li Date: Sat, 24 Feb 2024 14:35:21 -0600 Subject: [PATCH] Dart Fix --- lib/pages/page_styles.dart | 4 ++-- lib/ui/blocks.dart | 24 ++++++++++++------------ lib/ui/carousel/carousel.dart | 2 +- lib/ui/carousel/carousel_slide_1.dart | 7 +++---- lib/ui/carousel/carousel_slide_2.dart | 7 +++---- lib/ui/carousel/carousel_slide_3.dart | 7 +++---- lib/ui/carousel/carousel_slide_4.dart | 7 +++---- lib/utils/utils.dart | 15 ++++++++++----- 8 files changed, 37 insertions(+), 36 deletions(-) diff --git a/lib/pages/page_styles.dart b/lib/pages/page_styles.dart index aaef8ee..9cb671a 100644 --- a/lib/pages/page_styles.dart +++ b/lib/pages/page_styles.dart @@ -8,12 +8,12 @@ class TypographyPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( body: Stack( - children: [ + children: [ SingleChildScrollView( child: Container( margin: const EdgeInsets.symmetric(horizontal: 32), child: Column( - children: [ + children: [ Container( margin: marginBottom40, ), diff --git a/lib/ui/blocks.dart b/lib/ui/blocks.dart index 3c704f3..da56a4e 100644 --- a/lib/ui/blocks.dart +++ b/lib/ui/blocks.dart @@ -24,7 +24,7 @@ class WebsiteMenuBar extends StatelessWidget { ]), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Row( - children: [ + children: [ const Padding( padding: EdgeInsets.only(right: 16), child: Icon(Icons.menu, color: textPrimary, size: 28)), @@ -483,7 +483,7 @@ class Features extends StatelessWidget { rowFlex: 1, rowFit: FlexFit.tight, child: Column( - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 32), child: buildMaterialIconCircle( @@ -506,7 +506,7 @@ class Features extends StatelessWidget { rowFlex: 1, rowFit: FlexFit.tight, child: Column( - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 32), child: @@ -529,7 +529,7 @@ class Features extends StatelessWidget { rowFlex: 1, rowFit: FlexFit.tight, child: Column( - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 32), child: buildMaterialIconCircle( @@ -648,7 +648,7 @@ class _FastDevelopmentState extends State { child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: buildMaterialIconCircle( @@ -753,7 +753,7 @@ class _BeautifulUIState extends State { child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: buildMaterialIconCircle( @@ -894,7 +894,7 @@ class _NativePerformanceState extends State { child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: buildMaterialIconCircle( @@ -1008,7 +1008,7 @@ class _LearnFromDevelopersState extends State { child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ const Padding( padding: EdgeInsets.only(bottom: 32), child: @@ -1093,7 +1093,7 @@ class WhoUsesFlutter extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ const Padding( padding: EdgeInsets.only(bottom: 16), child: @@ -1193,7 +1193,7 @@ class FlutterNewsCard extends StatelessWidget { border: Border.all(color: border)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Container( constraints: const BoxConstraints(maxHeight: 400), child: Image.asset(imagePath, fit: BoxFit.fitWidth), @@ -1202,7 +1202,7 @@ class FlutterNewsCard extends StatelessWidget { padding: const EdgeInsets.fromLTRB(40, 40, 40, 40), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: const EdgeInsets.only(bottom: 16), child: Text("News", @@ -1490,7 +1490,7 @@ class Footer extends StatelessWidget { columnFit: FlexFit.loose, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ RichText( textAlign: TextAlign.left, text: TextSpan( diff --git a/lib/ui/carousel/carousel.dart b/lib/ui/carousel/carousel.dart index b58055e..b926cba 100644 --- a/lib/ui/carousel/carousel.dart +++ b/lib/ui/carousel/carousel.dart @@ -17,7 +17,7 @@ class Carousel extends StatefulWidget { Carousel({super.key}); @override - _CarouselState createState() => _CarouselState(); + State createState() => _CarouselState(); } class _CarouselState extends State diff --git a/lib/ui/carousel/carousel_slide_1.dart b/lib/ui/carousel/carousel_slide_1.dart index c7d3aa6..3b23e29 100644 --- a/lib/ui/carousel/carousel_slide_1.dart +++ b/lib/ui/carousel/carousel_slide_1.dart @@ -10,7 +10,7 @@ class CarouselSlide1 extends StatefulWidget { const CarouselSlide1({super.key, required this.slideDuration}); @override - _CarouselSlide1State createState() => _CarouselSlide1State(); + State createState() => _CarouselSlide1State(); } class _CarouselSlide1State extends State @@ -60,8 +60,7 @@ class _CarouselSlide1State extends State animation = Tween(begin: 0, end: 252).animate(animationController) ..addListener(() { setState(() { - slideItems = - getSlideItemAnimationUpdate(animation.value, slideItems); + slideItems = getSlideItemAnimationUpdate(animation.value, slideItems); }); }); animationController.forward(); @@ -73,7 +72,7 @@ class _CarouselSlide1State extends State width: 1200, height: 1200, child: Stack( - children: [ + children: [ Positioned( left: 449, top: 116, diff --git a/lib/ui/carousel/carousel_slide_2.dart b/lib/ui/carousel/carousel_slide_2.dart index a627735..fe6e9df 100644 --- a/lib/ui/carousel/carousel_slide_2.dart +++ b/lib/ui/carousel/carousel_slide_2.dart @@ -10,7 +10,7 @@ class CarouselSlide2 extends StatefulWidget { const CarouselSlide2({super.key, required this.slideDuration}); @override - _CarouselSlide2State createState() => _CarouselSlide2State(); + State createState() => _CarouselSlide2State(); } class _CarouselSlide2State extends State @@ -60,8 +60,7 @@ class _CarouselSlide2State extends State animation = Tween(begin: 0, end: 200).animate(animationController) ..addListener(() { setState(() { - slideItems = - getSlideItemAnimationUpdate(animation.value, slideItems); + slideItems = getSlideItemAnimationUpdate(animation.value, slideItems); }); }); animationController.forward(); @@ -73,7 +72,7 @@ class _CarouselSlide2State extends State width: 1200, height: 640, child: Stack( - children: [ + children: [ Positioned( left: 36, top: 136, diff --git a/lib/ui/carousel/carousel_slide_3.dart b/lib/ui/carousel/carousel_slide_3.dart index 92d69e1..f406e51 100644 --- a/lib/ui/carousel/carousel_slide_3.dart +++ b/lib/ui/carousel/carousel_slide_3.dart @@ -10,7 +10,7 @@ class CarouselSlide3 extends StatefulWidget { const CarouselSlide3({super.key, required this.slideDuration}); @override - _CarouselSlide3State createState() => _CarouselSlide3State(); + State createState() => _CarouselSlide3State(); } class _CarouselSlide3State extends State @@ -60,8 +60,7 @@ class _CarouselSlide3State extends State animation = Tween(begin: 0, end: 200).animate(animationController) ..addListener(() { setState(() { - slideItems = - getSlideItemAnimationUpdate(animation.value, slideItems); + slideItems = getSlideItemAnimationUpdate(animation.value, slideItems); }); }); animationController.forward(); @@ -73,7 +72,7 @@ class _CarouselSlide3State extends State width: 1200, height: 640, child: Stack( - children: [ + children: [ Positioned( left: 400, top: 117, diff --git a/lib/ui/carousel/carousel_slide_4.dart b/lib/ui/carousel/carousel_slide_4.dart index 3861e3f..8b30179 100644 --- a/lib/ui/carousel/carousel_slide_4.dart +++ b/lib/ui/carousel/carousel_slide_4.dart @@ -10,7 +10,7 @@ class CarouselSlide4 extends StatefulWidget { const CarouselSlide4({super.key, required this.slideDuration}); @override - _CarouselSlide4State createState() => _CarouselSlide4State(); + State createState() => _CarouselSlide4State(); } class _CarouselSlide4State extends State @@ -60,8 +60,7 @@ class _CarouselSlide4State extends State animation = Tween(begin: 0, end: 200).animate(animationController) ..addListener(() { setState(() { - slideItems = - getSlideItemAnimationUpdate(animation.value, slideItems); + slideItems = getSlideItemAnimationUpdate(animation.value, slideItems); }); }); animationController.forward(); @@ -73,7 +72,7 @@ class _CarouselSlide4State extends State width: 1200, height: 640, child: Stack( - children: [ + children: [ Positioned( left: 345, top: 132, diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 1244951..7677564 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -2,11 +2,16 @@ import 'package:flutter/foundation.dart'; import 'package:url_launcher/url_launcher.dart'; Future openUrl(String url, {bool newWindow = false}) async { - if (await canLaunch(url)) { - return await launch( - url, - ); - } else { + try { + if (await canLaunchUrl(Uri.parse(url))) { + return await launchUrl( + Uri.parse(url), + ); + } else { + debugPrint("Could not launch $url"); + return false; + } + } catch (e) { debugPrint("Could not launch $url"); return false; }