Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:tugas_flutter/main_page.dart';
- class Message1 extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- Widget receiverBubble({
- required imageUrl,
- required String text,
- required time,
- }) {
- return Container(
- margin: EdgeInsets.only(
- bottom: 30,
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Image.asset(
- imageUrl,
- width: 40,
- ),
- SizedBox(
- width: 12,
- ),
- Container(
- padding: EdgeInsets.symmetric(
- horizontal: 20,
- vertical: 12,
- ),
- decoration: BoxDecoration(
- color: Color(0xffEBEFF3),
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- topLeft: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- text,
- style: GoogleFonts.poppins(
- fontSize: 16,
- color: Color(0xff505C6B),
- ),
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- time,
- style: GoogleFonts.poppins(
- fontWeight: FontWeight.w300,
- color: Color(0xff505C6B),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
- Widget senderBubble({
- required String imageUrl,
- required String text,
- required String time,
- }) {
- return Container(
- margin: EdgeInsets.only(
- bottom: 30,
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Container(
- padding: EdgeInsets.symmetric(
- horizontal: 20,
- vertical: 12,
- ),
- decoration: BoxDecoration(
- color: Color(0xffFFFFFF),
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- topLeft: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- text,
- style: GoogleFonts.poppins(
- fontSize: 16,
- color: Color(0xff505C6B),
- ),
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- time,
- style: GoogleFonts.poppins(
- fontWeight: FontWeight.w300,
- color: Color(0xff505C6B),
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- width: 12,
- ),
- Image.asset(
- imageUrl,
- width: 40,
- ),
- ],
- ),
- );
- }
- Widget header() {
- return Container(
- width: double.infinity,
- height: 115,
- padding: EdgeInsets.all(30),
- decoration: BoxDecoration(
- color: Color(0xffFFFFFF),
- borderRadius: BorderRadius.vertical(
- bottom: Radius.circular(30),
- ),
- ),
- child: Row(
- children: [
- Image.asset(
- 'images/dokter1.png',
- width: 55,
- ),
- SizedBox(
- width: 12,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Jonathan Tesla',
- style: GoogleFonts.poppins(
- color: Color(0xff2C3A59),
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
- ),
- SizedBox(
- height: 2,
- ),
- Text(
- 'Dentist Spesialist',
- style: GoogleFonts.poppins(
- fontWeight: FontWeight.w300,
- color: Color(0xff808BA2),
- ),
- ),
- ],
- ),
- Spacer(),
- TextButton(
- onPressed: () {
- Navigator.pop(context);
- },
- child: Icon(
- Icons.arrow_back,
- color: Colors.grey,
- ),
- ),
- ],
- ),
- );
- }
- Widget body() {
- return Expanded(
- child: Padding(
- padding: EdgeInsets.symmetric(
- horizontal: 30,
- ),
- child: Column(
- children: [
- SizedBox(
- height: 30,
- ),
- senderBubble(
- imageUrl: 'images/client.png',
- text: 'Hallo Dok',
- time: '22:08',
- ),
- receiverBubble(
- imageUrl: 'images/dokter1.png',
- text: 'Ada yang bisa saya bantu?',
- time: '22:10',
- ),
- senderBubble(
- imageUrl: 'images/client.png',
- text: 'Kenapa RRQ Kalah dok?',
- time: '22:11',
- ),
- receiverBubble(
- imageUrl: 'images/dokter1.png',
- text: 'pertanyaan yang sulit untuk saya jawab',
- time: '22:12',
- ),
- ],
- ),
- ),
- );
- }
- Widget chatInput() {
- return Container(
- width: MediaQuery.of(context).size.width - (2 * 30),
- padding: EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: Color(0xffFFFFFF),
- borderRadius: BorderRadius.circular(75),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Ketik Pesan ...',
- style: GoogleFonts.poppins(
- fontWeight: FontWeight.w300,
- fontSize: 16,
- color: Color(0xff999999),
- ),
- ),
- Icon(
- Icons.send,
- color: Colors.blue,
- ),
- ],
- ),
- );
- }
- return Scaffold(
- backgroundColor: Color(0xffF8FAFC),
- floatingActionButton: chatInput(),
- floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
- body: SafeArea(
- child: Column(
- children: [
- header(),
- body(),
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement