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'; ...@@ -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/home2.dart';
import 'package:medapp_eksad/screen/home/home3.dart'; import 'package:medapp_eksad/screen/home/home3.dart';
import 'package:medapp_eksad/widget/responsive.dart'; import 'package:medapp_eksad/widget/responsive.dart';
import 'package:medapp_eksad/widget/whatsapp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
void setPageTitle(String title, BuildContext context) { void setPageTitle(String title, BuildContext context) {
...@@ -28,6 +29,7 @@ class _HomePageState extends State<HomePage> { ...@@ -28,6 +29,7 @@ class _HomePageState extends State<HomePage> {
var screenSize = MediaQuery.of(context).size; var screenSize = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
floatingActionButton: WAChat(),
appBar: ResponsiveWidget.isSmallScreen(context) appBar: ResponsiveWidget.isSmallScreen(context)
? AppBarKecil() ? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.blue, Colors.blue, : AppbarHomeLarge(screenSize, context, Colors.blue, Colors.blue,
......
...@@ -4,6 +4,7 @@ import 'package:medapp_eksad/screen/contact_us/contact_us1.dart'; ...@@ -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/contact_us/contact_us2.dart';
import 'package:medapp_eksad/screen/footer.dart'; import 'package:medapp_eksad/screen/footer.dart';
import 'package:medapp_eksad/widget/responsive.dart'; import 'package:medapp_eksad/widget/responsive.dart';
import 'package:medapp_eksad/widget/whatsapp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
void setPageTitle(String title, BuildContext context) { void setPageTitle(String title, BuildContext context) {
...@@ -27,18 +28,28 @@ class _ContactUsState extends State<ContactUs> { ...@@ -27,18 +28,28 @@ class _ContactUsState extends State<ContactUs> {
setPageTitle('Contact Us', context); setPageTitle('Contact Us', context);
var screenSize = MediaQuery.of(context).size; var screenSize = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: ResponsiveWidget.isSmallScreen(context) appBar: ResponsiveWidget.isSmallScreen(context)
? AppBarKecil() ? AppBarKecil()
: AppbarHomeLarge(screenSize, context, Colors.black, Colors.black, : AppbarHomeLarge(screenSize, context, Colors.black, Colors.black,
Colors.black, Colors.black, Colors.blue), Colors.black, Colors.black, Colors.blue),
body: ListView( body: ResponsiveWidget.isSmallScreen(context)
children: [ ? ListView(
const ContactUs1(), children: [
ContactUs2(), const ContactUs1(),
const Footer(), 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: ...@@ -233,6 +233,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
...@@ -268,6 +275,13 @@ packages: ...@@ -268,6 +275,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.7.0" 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: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -280,6 +294,13 @@ packages: ...@@ -280,6 +294,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.8.2"
spring:
dependency: "direct main"
description:
name: spring
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
...@@ -301,6 +322,20 @@ packages: ...@@ -301,6 +322,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" 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: term_glyph:
dependency: transitive dependency: transitive
description: description:
...@@ -322,6 +357,13 @@ packages: ...@@ -322,6 +357,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1" 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: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
......
...@@ -45,6 +45,7 @@ dependencies: ...@@ -45,6 +45,7 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
show_up_animation: ^2.0.0 show_up_animation: ^2.0.0
http: ^0.13.4 http: ^0.13.4
spring: ^2.0.2
dev_dependencies: dev_dependencies:
flutter_test: 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