Комментарии:
easy code for latest dart
body: Center(
child: ElevatedButton(
child: Text('takde pe'),
onPressed: () {},
),
),
I am getting error in Icons.. It is saying no directionlity widget found. Scaffold wodgets require a Directiomality widget ancestor.
Ответитьyour tutorial is really damn good and well explained. It helps me lot. Thank you!
Ответитьperfect
ОтветитьRaisedButton is deprecated. Use ElevatedButton:
child: ElevatedButton(
onPressed: () {},
child: Text('ClickMe'),
)
If you have errors on the onPressed: "Invalid constant value.", just remove the "const" word.
Note:7:50
body: Center(
child: ElevatedButton.icon
(onPressed: () {},
icon: Icon(Icons.mail),
label: Text('Mail Me'),
style: ElevatedButton.styleFrom(
primary: Colors.amber
),
),
),
FYI, "RaisedButton" has now been replaced by "ElevatedButton"
ОтветитьAs of May 2021 the RaisedButton class in flutter is deprecated. ElevatedButton class should be used instead. The later class will eventually be removed from flutter SDK, so it is suggested to move to the newer class.
ОтветитьThanks, Content Creator your level of explanation is perfect, I am new but the way you explain it, feels like Soon I will be a flatter programmer
Ответитьis there an update soon?
Ответитьwaiting for new update
Ответитьnew update please🥺
ОтветитьUpdate, The RaisedButton method is deprecated. Use ElevatedButton instead.
ОтветитьRaisedButton deprecated
ОтветитьThe names of buttons have change check docs to get the new name
ОтветитьSome buttons are deprecated and not working as 2023 May
So below are new ones:
FlatButton -> TextButton
RaisedButton -> ElevatedButton
OutlineButton -> OutlinedButton
If you are using Flutter 2.0 or above, you should use ElevatedButton instead of RaisedButton. Here's an example of using ElevatedButton:
ОтветитьOld Widget | Old Theme | New Widget | New Theme
FlatButton | ButtonTheme | TextButton | TextButtonTheme
RaisedButton |ButtonTheme | ElevatedButton | ElevatedButtonTheme
OutlineButton | ButtonTheme | OutlinedButton | OutlinedButtonTheme
Just to share the RaisedButton is deprecated and replaced by ElevatedButton.
ОтветитьThe RaisedButton, FlatButton and OutlineButton has been upgraded to ElevatedButton, FilledButton and OutlinedButton
And
The RaisedButton.Icon()
Is
ElevatedButton.icon()
With Flutter 2.0 RaisedButton is deprecated and replaced by ElevatedButton
ОтветитьThanks a lot, very easy understanding
ОтветитьThis course is perfect 😊 but can you update it pleaseeeee
Ответитьwhat about label ?
ОтветитьHere's a button example in August 2022, that actually works, even though 'FlatButton' is deprecated: import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Flutter FlatButton Example'),
),
body: Center(child: Column(children: <Widget>[
Container(
margin: EdgeInsets.all(25),
child: FlatButton(
child: Text('SignUp', style: TextStyle(fontSize: 20.0),),
onPressed: () {},
),
),
Container(
margin: EdgeInsets.all(25),
child: FlatButton(
child: Text('LogIn', style: TextStyle(fontSize: 20.0),),
color: Colors.blueAccent,
textColor: Colors.white,
onPressed: () {},
),
),
]
))
),
);
}
}
(love all those ))),}))s, like someone is a little () class crazy.
Probably half of the items you're working with no longer work with a 2022 version of the app. For example, RaisedButton is deprecated, so I comment that out. Can't compile. I don't know why, so I start removing things. I get to void main(); and still have errors. #$%@! Flutter seems like a really complicated framework. I looked for a 'hello world' app to start over: import 'package:flutter/material.dart';
void main() {
runApp(const GeeksForGeeks());
}
class GeeksForGeeks extends StatelessWidget {
const GeeksForGeeks({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Center(child: Text('Hello World')),
);
}
}
Can we use customise icon for mail?
ОтветитьJULY 26, 2022
For those struggling with ElevatedButton Color here's a code that works.
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.<color>,
),
child: Text('Click Me')
There seems error while printing 'you clicked me'. Help me.
ОтветитьI think an updated tutorial would be great some of the commands are outdated
ОтветитьRaisedButton has been deprecated
Use instead ElevatedButton
An example:
child: ElevatedButton(
onPressed: () {},
child: Text('click me'),
style: ElevatedButton.styleFrom(
primary: Colors.lightBlue,
),
Although without using color my button was already blue so you can substitute any of the other colors
thank you so much bro you are the best of the best
Ответитьhow to put the text just below the icon like Settings icon and down to that the text 'Settings' ?
ОтветитьHere while using color, I am getting an error as "The named parameter 'color' isn't defined." I have tried using flutter clean and Invalidate Caches/Restart method. Can anyone help me with this?
ОтветитьThank you for the tutorials.
sir! Icons are not showing?
what to do?
hey there, i saved this tutorial and i'm watching every single video . Thanks a lot for your videos, really helpful. But i have one tiny problem, when i click Ctrl+Q either in colors or icons i don't see colors i just have limited colors to use, and even in icons for example : airport_shuffle doesnt exists unless i wrote it manually ( doesn't exists in list). ( i downloaded the same android studio u mentioned in description down below the video) what should i do to solve this problem ?
ОтветитьThank you so much. I honestly believe you are a great teacher.
Ответитьis anybody's button not printing to their cosole
Ответитьdoes flutter allow us to show like icon on the corner of the message box like how it is displayed on iOS chat application? - thanks
ОтветитьNice video
ОтветитьThese are great! Thank you so much!!!
ОтветитьIn this video you use deprecated widgets
ОтветитьI am cambodian. I like your video . Thanks for your sharing .
Ответитьthank you so much for this series! :D
ОтветитьWhat if I need to place an icon on end?
Ответить