Commit bbe60556 authored by r.manan@eksad.com's avatar r.manan@eksad.com

home: floating WA

parent 14c7a855
......@@ -4,6 +4,7 @@ import 'package:medapp_eksad/screen/footer.dart';
import 'package:medapp_eksad/screen/home/home2.dart';
import 'package:medapp_eksad/screen/home/home3.dart';
import 'package:medapp_eksad/widget/responsive.dart';
import 'package:medapp_eksad/widget/whatsapp.dart';
import 'package:flutter/services.dart';
void setPageTitle(String title, BuildContext context) {
......@@ -28,6 +29,7 @@ class _HomePageState extends State<HomePage> {
var screenSize = MediaQuery.of(context).size;
return Scaffold(
key: _scaffoldKey,
floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context)
? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.blue, Colors.blue,
......
......@@ -4,6 +4,7 @@ import 'package:medapp_eksad/screen/contact_us/contact_us1.dart';
import 'package:medapp_eksad/screen/contact_us/contact_us2.dart';
import 'package:medapp_eksad/screen/footer.dart';
import 'package:medapp_eksad/widget/responsive.dart';
import 'package:medapp_eksad/widget/whatsapp.dart';
import 'package:flutter/services.dart';
void setPageTitle(String title, BuildContext context) {
......@@ -32,13 +33,23 @@ class _ContactUsState extends State<ContactUs> {
? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.black, Colors.black,
Colors.black, Colors.black, Colors.blue),
body: ListView(
body: ResponsiveWidget.isSmallScreen(context)
? ListView(
children: [
const ContactUs1(),
ContactUs2(),
const Footer(),
],
)
: ListView(
children: [
ContactUs1(),
ContactUs2(),
Footer(),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: WAChat()
);
}
......
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:spring/spring.dart';
class WAChat extends StatelessWidget {
WAChat({Key? key}) : super(key: key);
void launchWhatsApp({
required final int phone,
required String message,
}) async {
String url() {
return "https://api.whatsapp.com/send?phone=$phone&text=${Uri.parse(message)}";
}
if (await canLaunch(url())) {
await launch(url());
} else {
throw 'Could not launch ${url()}';
}
}
final SpringController springController =
SpringController(initialAnim: Motion.play);
@override
Widget build(BuildContext context) {
return FloatingActionButton(
onPressed: () {
launchWhatsApp(
phone: 6281807890777,
message:
'Hallo, saya tertarik dengan produk EKSAD dan saya ingin tahu lebih lanjut tentang program Protalent');
},
backgroundColor: Colors.green,
child: GestureDetector(
onTap: () {
springController.play(
motion: Motion.reverse,
animDuration: const Duration(milliseconds: 1000),
curve: Curves.easeInBack,
delay: const Duration(milliseconds: 100));
launchWhatsApp(
phone: 6281807890777,
message:
'Hallo, saya tertarik dengan produk EKSAD dan saya ingin tahu lebih lanjut tentang program Protalent');
},
child: Spring.rotate(
endAngle: 360 * 10,
animDuration: const Duration(seconds: 3 * 10),
springController: springController,
alignment: Alignment.center,
animStatus: (AnimStatus status) {},
child: const Icon(Icons.whatsapp, size: 30),
),
),
);
}
}
......@@ -233,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
platform:
dependency: transitive
description:
......@@ -268,6 +275,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.0"
simple_animations:
dependency: transitive
description:
name: simple_animations
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sky_engine:
dependency: transitive
description: flutter
......@@ -280,6 +294,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
spring:
dependency: "direct main"
description:
name: spring
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
stack_trace:
dependency: transitive
description:
......@@ -301,6 +322,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
supercharged:
dependency: transitive
description:
name: supercharged
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
supercharged_dart:
dependency: transitive
description:
name: supercharged_dart
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
term_glyph:
dependency: transitive
description:
......@@ -322,6 +357,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
universal_platform:
dependency: transitive
description:
name: universal_platform
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+1"
url_launcher:
dependency: "direct main"
description:
......
......@@ -45,6 +45,7 @@ dependencies:
cupertino_icons: ^1.0.2
show_up_animation: ^2.0.0
http: ^0.13.4
spring: ^2.0.2
dev_dependencies:
flutter_test:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment