Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes: url launcher #202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions elaichi/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,15 @@
android:resource="@drawable/launch_background"
/>
</application>
<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
</queries>
</manifest>
24 changes: 15 additions & 9 deletions elaichi/lib/presentation/components/custom_cards/devCard.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:elaichi/presentation/core/theme/colors.dart';
import 'package:elaichi/presentation/core/utils/urlLauncher.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
Expand Down Expand Up @@ -34,48 +36,52 @@ class DevCard extends StatelessWidget {
alignment: AlignmentDirectional.center,
children: [
Container(
height: width*0.19,
width: width*0.19,
height: width*0.15,
width: width*0.15,
decoration: BoxDecoration(
color: Color(0xFF444444),
borderRadius: BorderRadius.circular(width*0.095),
),
),
Container(
clipBehavior: Clip.antiAliasWithSaveLayer,
height: width*0.176,
width: width*0.176,
height: width*0.138,
width: width*0.138,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(width*0.088),
),
child: Image.network(photo),
child: CachedNetworkImage(
imageUrl: photo,
placeholder: (context, url) => const CircularProgressIndicator(),
errorWidget: (context, url, error) => Icon(Icons.person, color: AppColors.newEventBtn, size: width*0.086,),
),
),
],
),
SizedBox(width: width*0.05),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
SizedBox(
width: width*0.55,
child: AutoSizeText(
name,
style: GoogleFonts.inter(
fontSize: width*0.05,
fontSize: width*0.048,
fontWeight: FontWeight.w600,
color: Color(0xFF202020),
),
maxLines: 1,
),
),
SizedBox(height: 2),
Container(
SizedBox(
width: width*0.55,
child: AutoSizeText(
role,
style: GoogleFonts.inter(
fontSize: width*0.038,
fontSize: width*0.036,
fontWeight: FontWeight.w500,
color: Color(0xFF555555),
),
Expand Down
10 changes: 4 additions & 6 deletions elaichi/lib/presentation/core/utils/urlLauncher.dart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a service called ThirdPartyServices. It has url launcher, use that

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:url_launcher/url_launcher.dart';

launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url, enableJavaScript: true, forceWebView: false);
} else {
throw 'Could not launch $url';
Future<void> launchURL(String url) async {
if (!await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication)) {
throw Exception('Could not launch $url');
}
}
}
2 changes: 1 addition & 1 deletion elaichi/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.6"
version: "6.1.10"
url_launcher_android:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion elaichi/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
graphql: ^5.1.1
collection: ^1.16.0
shimmer: ^2.0.0
url_launcher: ^6.1.5
url_launcher: ^6.1.10
cached_network_image: ^3.2.1
intl: ^0.17.0
carousel_slider: ^4.1.1
Expand Down