launchify 1.0.5
launchify: ^1.0.5 copied to clipboard
A powerful Flutter URL launcher UI package for WhatsApp, Phone, Email, Maps, Social Apps, deep links, and custom URI schemes with customizable action buttons, link rows, app checks, and RTL support.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:launchify/launchify.dart';
import 'package:launchify/l10n/app_localizations.dart';
import 'package:launchify/models/launch_options.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Launchify Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
useMaterial3: true,
),
home: const LaunchifyDemoScreen(),
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en', ''), // English
Locale('ar', ''), // Arabic
],
);
}
}
class LaunchifyDemoScreen extends StatelessWidget {
const LaunchifyDemoScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Launchify 🚀'),
centerTitle: true,
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionHeader(context, "ActionButton Mode (URL Hidden)"),
const SizedBox(height: 12),
Wrap(
spacing: 12,
runSpacing: 12,
children: [
const LaunchLink(
type: LaunchType.whatsapp,
value: "+923001234567",
label: "WhatsApp",
customIcon: LaunchIcon.fromNetwork(
"https://freepngimg.com/thumb/gmail/64774-computer-gmail-email-icons-png-image-high-quality.png",
),
style: LaunchStyle(
iconColor: Colors.white,
backgroundColor: Colors.red,
),
),
const LaunchLink(
type: LaunchType.phone,
value: "123456789",
label: "Call Support",
style: LaunchStyle(backgroundColor: Colors.green),
),
const LaunchLink(
type: LaunchType.email,
value: "hello@example.com",
queryParameters: {'subject': "Inquiry from App"},
label: "Email Us",
style: LaunchStyle(backgroundColor: Colors.orange),
),
LaunchLink(
type: LaunchType.website,
value: "https://flutter.dev",
label: "Flutter Website",
style: LaunchStyle(
backgroundColor: Colors.blue.shade800,
borderRadius: 30,
),
),
const LaunchLink(
type: LaunchType.map,
value: "Googleplex",
label: "Find Us on Map",
style: LaunchStyle(
isOutlined: true,
textColor: Colors.indigo,
),
),
LaunchLink(
type: LaunchType.share,
label: "Share App",
icon: Icons.share,
queryParameters: const {
'text':
'Check out Launchify, a powerful Flutter package for launching various app actions!',
'subject': 'Launchify Flutter Package',
},
style: LaunchStyle(backgroundColor: Colors.blueGrey),
),
const LaunchLink(
type: LaunchType.instagram,
value:
"https://www.instagram.com/reel/DT2Uqd9igB2/?igsh=MWpwZ2l6OGlleHRwaA==",
label: "Instagram",
style: LaunchStyle(backgroundColor: Colors.pink),
),
const LaunchLink(
type: LaunchType.tiktok,
value:
"https://www.tiktok.com/@ahmedtypists04/video/7595202620600470814?is_from_webapp=1&sender_device=pc",
label: "TikTok",
style: LaunchStyle(backgroundColor: Colors.black),
),
const LaunchLink(
type: LaunchType.linkedin,
value:
"https://www.linkedin.com/in/muhammad-imran-32846013a?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app",
label: "LinkedIn",
style: LaunchStyle(backgroundColor: Colors.blue),
),
const LaunchLink(
type: LaunchType.facebook,
value: "https://www.facebook.com/share/r/1AmHT13RNs/",
// Example Facebook page/profile
label: "Facebook",
style: LaunchStyle(backgroundColor: Colors.blueAccent),
),
const LaunchLink(
type: LaunchType.github,
value: "launchify", // Example GitHub username/repo
label: "GitHub",
style: LaunchStyle(backgroundColor: Colors.grey),
),
LaunchLink(
type: LaunchType.calendar,
label: "Add Event",
calendarEvent: CalendarEvent(
title: 'Launchify Demo',
description: 'Demonstration of Launchify package features.',
startDate: DateTime.now(),
endDate: DateTime.now().add(const Duration(hours: 1)),
allDay: false,
location: 'Virtual',
),
style: LaunchStyle(backgroundColor: Colors.deepOrange),
),
],
),
const SizedBox(height: 32),
_buildSectionHeader(context, "LinkRow Mode (URL Visible)"),
const SizedBox(height: 12),
Card(
elevation: 0,
color: Theme.of(
context,
).colorScheme.surfaceContainerHighest.withValues(alpha: 0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
LaunchLink(
mode: LaunchDisplayMode.linkRow,
type: LaunchType.email,
value: "support@launchify.io",
),
Divider(indent: 40),
LaunchLink(
mode: LaunchDisplayMode.linkRow,
type: LaunchType.phone,
value: "+1 555 010 999",
visibleText: "+1 (555) 010-999 (Headquarters)",
),
Divider(indent: 40),
LaunchLink(
mode: LaunchDisplayMode.linkRow,
type: LaunchType.website,
value: "www.github.com",
visibleText: "View Source on GitHub",
icon: Icons.code,
),
Divider(indent: 40),
LaunchLink(
mode: LaunchDisplayMode.linkRow,
type: LaunchType.website,
value: "https://launchify.io",
visibleText: "Launchify Website (No Underline)",
showUnderline: false,
icon: Icons.link_off,
style: LaunchStyle(textColor: Colors.grey),
),
],
),
),
),
const SizedBox(height: 32),
_buildSectionHeader(context, "Full Customization"),
const SizedBox(height: 12),
LaunchLink(
type: LaunchType.sms,
value: "555123",
queryParameters: {'body': "Hello from Launchify!"},
label: "SEND SECURE SMS",
style: LaunchStyle(
backgroundColor: Colors.black,
textColor: Colors.yellow,
iconColor: Colors.yellow,
fontSize: 18,
fontWeight: FontWeight.w900,
height: 60,
borderRadius: 0,
padding: const EdgeInsets.symmetric(horizontal: 40),
),
),
const SizedBox(height: 12),
LaunchLink(
type: LaunchType.website,
value: "https://pub.dev",
label: "VISIT PUB.DEV",
style: LaunchStyle(
isOutlined: true,
borderColor: Colors.red,
borderWidth: 2,
textColor: Colors.red,
borderRadius: 4,
),
),
const SizedBox(height: 32),
_buildSectionHeader(context, "Icon Customization"),
const SizedBox(height: 12),
const Wrap(
spacing: 12,
runSpacing: 12,
children: [
LaunchLink(
type: LaunchType.website,
value: "https://google.com",
label: "No Icon",
showIcon: false,
),
LaunchLink(
type: LaunchType.website,
value: "https://flutter.dev",
customIcon: LaunchIcon.fromAsset('assets/test_icon.svg'),
),
],
),
const SizedBox(height: 32),
_buildSectionHeader(context, "Multi-Choice Dialog"),
const SizedBox(height: 12),
LaunchLink(
type: LaunchType.map,
value: "New York City",
label: "Open Map (Chooser)",
style: LaunchStyle(backgroundColor: Colors.blueGrey),
options: LaunchOptions(
useMultiChoiceDialog: true,
dialogTitle: "Choose a Map App",
dialogMessage: "Select an application to open the map:",
),
),
const SizedBox(height: 32),
_buildSectionHeader(context, "RTL Support Preview"),
const SizedBox(height: 8),
const Text(
"Automatically flips icons and alignment in RTL locales (e.g., Arabic, Urdu).",
style: TextStyle(color: Colors.grey, fontSize: 13),
),
const SizedBox(height: 12),
Directionality(
textDirection: TextDirection.rtl,
child: LaunchLink(
mode: LaunchDisplayMode.linkRow,
type: LaunchType.whatsapp,
value: "+923001234567",
visibleText: "تواصل معنا عبر واتساب",
style: LaunchStyle(
iconColor: Colors.green,
textColor: Colors.green.shade900,
),
),
),
],
),
),
);
}
Widget _buildSectionHeader(BuildContext context, String title) {
return Text(
title,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
),
);
}
}