From cd3d2d59b3247c9239bc36db11dafcb352de7c8f Mon Sep 17 00:00:00 2001 From: MohammadTaha Basiri Date: Sun, 6 Mar 2022 12:53:59 +0330 Subject: [PATCH] bug fixes + terms of use --- .../authentication/screens/username.dart | 9 +++++++-- lib/views/home/widgets/bnb.dart | 9 ++++++++- lib/views/widgets/didvan/page_view.dart | 6 +++--- lib/views/widgets/skeleton_image.dart | 20 +++++++++---------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lib/views/authentication/screens/username.dart b/lib/views/authentication/screens/username.dart index fcec2fd..e17f598 100644 --- a/lib/views/authentication/screens/username.dart +++ b/lib/views/authentication/screens/username.dart @@ -5,6 +5,7 @@ import 'package:didvan/views/widgets/didvan/text_field.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class UsernameInput extends StatefulWidget { const UsernameInput({ @@ -70,7 +71,7 @@ class _UsernameInputState extends State { .textTheme .caption! .copyWith(color: Theme.of(context).colorScheme.primary), - recognizer: TapGestureRecognizer()..onTap = () {}, + recognizer: TapGestureRecognizer()..onTap = _openTermsOfUse, ), const TextSpan(text: 'و\n'), TextSpan( @@ -79,7 +80,7 @@ class _UsernameInputState extends State { .textTheme .caption! .copyWith(color: Theme.of(context).colorScheme.primary), - recognizer: TapGestureRecognizer()..onTap = () {}, + recognizer: TapGestureRecognizer()..onTap = _openTermsOfUse, ), const TextSpan(text: 'را می‌پذیرم'), ], @@ -92,4 +93,8 @@ class _UsernameInputState extends State { ], ); } + + void _openTermsOfUse() { + launch('https://didvan.app/termsOfUse.html'); + } } diff --git a/lib/views/home/widgets/bnb.dart b/lib/views/home/widgets/bnb.dart index 42d8ad9..05c499a 100644 --- a/lib/views/home/widgets/bnb.dart +++ b/lib/views/home/widgets/bnb.dart @@ -19,7 +19,14 @@ class DidvanBNB extends StatelessWidget { decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), - boxShadow: DesignConfig.defaultShadow, + boxShadow: [ + BoxShadow( + offset: const Offset(0, -18), + color: const Color(0XFF1B3C59).withOpacity(0.25), + blurRadius: 40, + spreadRadius: -15, + ), + ], ), padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( diff --git a/lib/views/widgets/didvan/page_view.dart b/lib/views/widgets/didvan/page_view.dart index a4b6a62..aba3078 100644 --- a/lib/views/widgets/didvan/page_view.dart +++ b/lib/views/widgets/didvan/page_view.dart @@ -209,14 +209,14 @@ class _DidvanPageViewState extends State { child: Center( child: SkeletonImage( width: MediaQuery.of(context).size.width, - height: 200, imageUrl: content.image, ), ), ), ), const Positioned( - right: 16, + right: 24, + top: 24, child: _BackButton(), ), ], @@ -225,7 +225,7 @@ class _DidvanPageViewState extends State { }, child: SkeletonImage( imageUrl: content.image!, - aspectRatio: 16 / 9, + width: double.infinity, ), ); } diff --git a/lib/views/widgets/skeleton_image.dart b/lib/views/widgets/skeleton_image.dart index bf7db1c..c59f431 100644 --- a/lib/views/widgets/skeleton_image.dart +++ b/lib/views/widgets/skeleton_image.dart @@ -8,17 +8,17 @@ import 'package:cached_network_image_platform_interface/cached_network_image_pla class SkeletonImage extends StatelessWidget { final String imageUrl; - final double width; - final double height; + final double? width; + final double? height; final BorderRadius? borderRadius; final double? aspectRatio; const SkeletonImage({ Key? key, required this.imageUrl, - this.width = 300, - this.height = 140, this.borderRadius = DesignConfig.lowBorderRadius, this.aspectRatio, + this.width, + this.height, }) : super(key: key); @override @@ -30,13 +30,11 @@ class SkeletonImage extends StatelessWidget { width: width, height: height, imageUrl: RequestHelper.baseUrl + imageUrl, - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - borderRadius: borderRadius ?? DesignConfig.lowBorderRadius, - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, - ), + imageBuilder: (context, imageProvider) => ClipRRect( + borderRadius: borderRadius ?? DesignConfig.lowBorderRadius, + child: Image( + image: imageProvider, + fit: BoxFit.cover, ), ), progressIndicatorBuilder: (context, url, progress) =>