How to add whatsapp image in floating action button in flutter - android

How to add whatsapp image in floating action button in flutter because whatsapp icon is not in flutter icon list. Tell me a simple method.
Row(
children: [
FloatingActionButton(
child: const Icon(Icons.chat),
backgroundColor: Colors.green.shade800,
onPressed: () {
String url =
"https://wa.me/+923045873730/?text=Hello";
launch(url);
},
),
],
),

Font Awesome has a flutter package that helps with most icons that are not in flutter default icon set, https://pub.dev/packages/font_awesome_flutter. It also includes all icons listed in font Awesome Offical website https://fontawesome.com/icons
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Row(
children: [
FloatingActionButton(
child: FaIcon(FontAwesomeIcons.whatsapp),
backgroundColor: Colors.green.shade800,
onPressed: () {
String url =
"https://wa.me/+923045873730/?text=Hello";
launch(url);
},
),
],
),

The easiest way that comes to my mind is that downloading the icon image of Whatsapp (from flaticon or other website), adding it to the project's assets and adding it as a child( for example asset image).

Related

How to solve ElevatedButton error in flutter

I am new to flutter and I am developing an app in Flutter. While I am doing this, I try to add ElevatedButton which is the latest version of RaisedButton, and its return error and I am also not sure why. I will insert the error code image and would be grateful if someone tells me what is the reason for the error and how to solve it. Thank you
You need to add a child widget (it is required in addition to onPressed function). Here is a sample code for Elevated Button. You can adjust it based on your needs:
ElevatedButton(
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: Color(0xffccbbd7),
minimumSize: const Size(330,70),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(5),
),
),
),
onPressed: () {},
child: const Text('click'),
),
You Forgot the child Widget inside ElevatedButton, in this button onPressed and child widgets are required
Refer ElevatedButton
Try below code
ElevatedButton(
onPressed: () {
// write your onPressed function here
print('Button Pressed');
},
child: const Text('Press Me'),
),
Your result screen->
Well, elevated button should have child inside. Can be text, icon or image
ElevatedButton(
onPressed: () {
print('Tombol baru saja ditekan!');
},
child: const Text('Hit me!'),
),

Is there a widget in flutter that allows you to create such a view?

I need to implement such a widget in Flutter. Full version of the page, where this widget is going to be used is here Maybe you know build-in widgets, which could help me. But if there are none, what is the best way to implement this widget?
You can use a ListTile
ListTile(
leading: const Text("Lbikgabsb"),
trailing: Column(
children: [
const Text("900 P"),
const Text("2"), // add your decoration to the background
),
],
),
),
Alternatively you can use:
SizedBox(
height: your_height,
width:double.infinity,
child: Row(
children:[
Text("Lbikgabsb"),
Column(
children: [
const Text("900 P"),
const Text("2"), // add your decoration to the background
],
),
),
You can choose whichever approach works best for your app

New Flutter app has same font style as one of my previous apps

I created a new Flutter app from scratch, in Android Studio. In one of my previous apps, I intentionally used a weird font style. Now, for some reason, the new app has the same fonts. Is it possible that I had stored some "global" font style somewhere in the Android Studio, and now it's getting re-used? How can I get rid of it and revert the "normal" fonts?
Here's the code of one widget and its screenshot in the emulator:
import 'package:flutter/material.dart';
class LoginScreen extends StatelessWidget {
#override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
child: Column(
children: <Widget>[
RaisedButton(
child: Text('Login'),
onPressed: () {
Navigator.pushNamed(context, '/');
},
),
Text('Login'),
],
),
),
);
}
}
No, there shouldn't be.
In my case it also appeared in the debug app, but disappeared again when I recompiled the project. I haven't seen it in a finished app yet.

Why is the text widget underlined?

Hey guys I have a question. I tried to ad a new text widget in my code (just as always), but it is red underlined. I don´t know why. In my opinion everything is right. I copied the same text widget one line below and in that line it isn´t underlined. Can anybody say my what the reason therefore is? (I added a link in which you should find the part of the code.
This is the code
pic of the widgets
You have to add , after RaisedButton.
Column(
children: <Widget>[
RaisedButton(
child: Text("Button"),
onPressed: (){
},
), // <--- here
Text("Simple"),
Text("simple"),
],
),
It's underline because it's missing a comma before your Text Widget :
RaisedButton(
child: Text(startStopButtonDesign),
onPressed: () {
startOrStop();
},
), //Missing commma
Text(_time.toString()),

How can i load an image in between a text in Flutter

I need to display content containing text and images from an API on my android app, when I save it in a variable of type String, the texts get displayed but the images shows as url. How do I load the get the links to load in between the texts?
I needed to insert an Image inline with a sentence of texts.
So for that I used this:
final String paragraph1 =
'Advanciti App is an app where you can study and make friends with people living near your home. Advanciti is an Edtech Startup based out of Pune, Maharashtra, India.\n';
RichText(
text: TextSpan(
children: [
TextSpan(text: "The "),
WidgetSpan(child: Container(width: 20.0, child: Image.asset('assets/app_icon.png', scale: 1))),
TextSpan(text: paragraph1),
],
),
),
if you want to show images you need to convert your data to HTML or Markdown. in MarkDown and HTML, you can show much more then the image. these are packages for HTML and MarkDown:
flutter_html
flutter_markdown
You can use the following to place an image between two texts vertically:
Column(
children: <Widget>[
Text("Hello"),
Image.network(
'REPLACE HERE WITH YOUR IMG URL'),
Text("World")
],
),
or you can use this to place an image between two texts horizontally:
Row(
children: <Widget>[
Text("Hello"),
Image.network(
'REPLACE HERE WITH YOUR IMG URL'),
Text("World")
],
),

Categories

Resources