Flutter Heroes
26.1K subscribers
272 photos
2 videos
31.1K links
Download Telegram
New post on Flutter Dev Google group:

Flutter refresh list calling function from other class
Hello I want to build comments with refresh indicator but I get the below error, I am calling the function from class modalcomments.dart and the fuction is in the home.dart, if I try to add the full function in the modalcomments.dart again I get the below error home.dart getComments(postid)

May 08, 2020 at 04:51PM by Evripides Kyriacou
https://ift.tt/2zjTdMX
New post on /r/flutterdev subreddit:

<b>Pass Args to Widget Build</b>
Hey all, first post and started with flutter yesterday.I have created the below which I call using; ProductTile()The code renders a box that contains product information, an image etc, along with an increment counter which adjusts itself as buttons - or + are pressed. (this will eventually be quantity to add to basket).My problem is that it is all hard coded, I need to figure out how to make this dynamic.Am i not able to force this to take an argument and pass the argument when i call the function / builder (not sure). i.e..ProductTile(<Product>)<Product> Would be json format? Is this doable or am i barking up the wrong tree with Flutters workings?<pre>import 'package:flutter/material.dart'; class ProductTile extends StatefulWidget { @override _ProductTileState createState() => _ProductTileState(); } class _ProductTileState extends State<ProductTile> { int _counter = 0; void _incrementAdd() { setState(() { _counter++; }); } void _incrementSubtract() { setState(() { if (_counter > 0) { _counter--; } }); } void _basketAdd() { setState(() { _counter = 0; }); } @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.only(bottom: 10.0), child: Container( padding: const EdgeInsets.all(10), height: 350, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(15)), boxShadow: [ BoxShadow( color: Colors.grey, offset: Offset(-1, 1), blurRadius: 5, ), ], ), child: Column( children: <Widget>[ Container( height: 20, decoration: const BoxDecoration(color: Colors.transparent), child: Row( children: [ Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( '£', style: TextStyle( fontSize: 12, ), ), Text( '199', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16, ), ), Text( '99', style: TextStyle( fontSize: 12, ), ), ], ), ), SizedBox( width: 10, ), Container( child: Text( 'Product Offer', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16, ), ), ), ], ), ), SizedBox(height: 5), Material( elevation: 2.0, borderRadius: BorderRadius.all(Radius.circular(10)), child: Container( height: 250, decoration: const BoxDecoration( color: Colors.deepOrange, borderRadius: BorderRadius.all(Radius.circular(10))), child: Image(image: AssetImage('assets/echo.jpg')), ), ), SizedBox(height: 7.25), SizedBox( width:double.infinity, height: 0.5, child: const DecoratedBox( decoration: const BoxDecoration( color: Colors.grey ), ), ), SizedBox(height: 7.25), Container( height: 40, decoration: const BoxDecoration(color: Colors.transparent), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Material( elevation: 2.0, color: Colors.deepOrange, child: InkWell( splashColor: Colors.white70, onTap: _incrementSubtract, child: Container( width: 30, height: 30, child: Padding( padding: EdgeInsets.all(1.0), child: const Icon( Icons.remove, color: Colors.white, ), ), ), ), ), SizedBox(width: 5.0), Material( elevation: 2.0, borderRadius: BorderRadius.all(Radius.circular(20)), child: Container( width: 50, height: 50, decoration: BoxDecoration( border: Border.all(width: 2, color: Colors.deepOrange), borderRadius: BorderRadius.all(Radius.circular(20)), color: Colors.white), child: Center( child: Text( '$_counter', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18, ), ), ), ), ), SizedBox(width: 5.0), Material( elevation: 2.0, color: Colors.deepOrange, child: InkWell( splashColor: Colors.white70, onTap: _incrementAdd, child: Container( width: 30, height: 30, child: Padding( padding: EdgeInsets.all(1.0), child: const Icon( Icons.add, color: Colors.white, )), ), ), ), SizedBox(width: 20.0), Material( elevation: 2.0, color: Colors.deepOrange, borderRadius: BorderRadius.all(Radius.circular(5)), child: InkWell( splashColor: Colors.white70, onTap: _basketAdd, child: Row( children: <Widget>[ Container( width: 20, height: 30, child: Padding( padding: EdgeInsets.all(1.0), child:…
New post on /r/flutterdev subreddit:

Flutter Dependency Hell
Every time I introduce a dependency into Flutter, my entire project blows up.For example, just now, I added https://pub.dev/packages/firebase_uiAnd suddenly now I need to update all my other firebase dependencies, and the app mysteriously crashes. I am still trying to fix. It's probably yet again a dependency I am using which is not compatible. This is just my latest example. This happens nearly every time I add a new dependency.This happened with https://pub.dev/packages/rxdart a few months ago too etc.Does anyone have a solution or a way they work with this?

May 08, 2020 at 05:06PM by dolanmiu
https://ift.tt/3fvOlVw
New post on /r/flutterdev subreddit:

Codepen Challange Rocket Challange - not only for Vue.js
The CodePen Challenge this week was only for Vue.js, so I decided to recreate their starter pen, that we can all participate in the fun. So if you are interested, feel free to join.CodePen Challange - https://codepen.io/challenges/2020/may/
Rocket Challenge Starter - https://codepen.io/md-weber/pen/wvKpRXJ

May 08, 2020 at 05:59PM by MyracleDesign
https://ift.tt/2WCPAtv
New tweet from FlutterDev:

What day is it? 🤷&zwj;♀️#FlutterFriday!

Want to know how much to trust a new package?

💡Start with Flutter Favorites -- these are packages by verified publishers and have been checked for good runtime behavior.

💡Look at a package's score on pub -- the closer to 100, the better! pic.twitter.com/iKOJjVo6oa— Flutter (@FlutterDev) May 8, 2020

May 08, 2020 at 06:21PM
http://twitter.com/FlutterDev/status/1258794205393981442
New post on /r/flutterdev subreddit:

Is it worth learning flutter (career wise) if you have no experience of native application development?
I'm a web developer but flutter really looks cool nd I'm interested in learning/developing apps in it nd might consider switching to flutter development full time if got the right opportunity. But I have 0 experience of developing apps so I want to know if it's wroth learning flutter, career wise, if you have no experience in Android or iOS development? Can one possibly gets a job without native application development? I consider myself mid-level developer with 3 years of experience. I don't wanna get hired as freshie.

May 08, 2020 at 07:17PM by one_lame_programmer
https://ift.tt/3fw6bb8
New post on /r/flutterdev subreddit:

Why does Flutter style widgets structurally?
Newbie to Flutter and curious why Flutter expresses styles structurally. The Center and Padding, etc. widgets remind me of the <center>, <font>, <big>, etc tags in HTML that have been replaced by CSS styles. So why did Flutter take this approach?

May 08, 2020 at 07:06PM by JianingTX
https://ift.tt/2zixvcn
New post on /r/flutterdev subreddit:

Todo – really simple one-liner package for using Kotlin-style TODO()
https://ift.tt/2YI8Ok9

May 08, 2020 at 07:36PM by MarcelGarus
https://ift.tt/2WfZemU
New tweet from FlutterDev:

😲Are your widgets crowding each other?

👉Use Padding widget to provide widgets with some breathing room. Tell it how much space to give with the padding property, and voilà! You've added some distance between your widgets.#WidgetoftheWeek &rarr; https://t.co/6OhZ1j2ime pic.twitter.com/bYzwOC7jYX— Flutter (@FlutterDev) May 8, 2020

May 08, 2020 at 08:04PM
http://twitter.com/FlutterDev/status/1258819997100412933
New post on /r/flutterdev subreddit:

Tiled map library ?
I am looking forward to make a SimCity Like game with tiled auto-generated map with scrolling. I've found 2 libraries : + https://pub.dev/packages/tiled + https://github.com/DanTup/tilerAny advice about choosing one of them ?

May 08, 2020 at 08:58PM by pseeec
https://ift.tt/3dxnFlp
New post on /r/flutterdev subreddit:

<b>18+ Flutter tips & tricks</b>
If you want to produce (or reproduce) a production ready flutter app, we have 18+ tips and tricks for you. &#128071;<strong>1. Create Intro Screen in Just 10 Minutes</strong>If you need an awesome intro screen but don’t have an awesome idea, <a href="https://pub.dev/packages/introduction_screen">Introduction Screen</a> will save you. You'll be amazed.<strong>2. Use Flutter Snippet</strong>If you need productivity, Flutter Code Snippet will make you a superstar. You can easily create commonly used Flutter classes and methods. For example, you can create StreamBuilder Widget or SingleChildScrollView Widget by typing the shortcut streamBldr and singleChildSV respectively. You can use the flutter snippet in <a href="https://github.com/benznest/flutter-snippet">Android Studio</a> or <a href="https://marketplace.visualstudio.com/items?itemName=Nash.awesome-flutter-snippets">VSCode</a>.<strong>3. Create Mind-blowing Icons Using Font Awesome</strong>You don’t have to be the designer to include mind-blowing icons in your app. Just use the <a href="https://pub.dev/packages/font_awesome_flutter#-readme-tab-">font awesome for flutter</a> and you will create magic in minutes.<strong>4. Enjoy Dependency Magic Using</strong> <strong>get.it</strong>A good practice is to put your app’s logic in classes separated from your Widgets and then inject it wherever needed. For example, one of my app, we need to access the Prefmanger class from multiple places to read and update the user state stored in the localstorage. We used <a href="https://pub.dev/packages/get_it">get_it</a> so that this class can be injectable as a dependency.<code>GetIt locator = GetIt.instance;</code><code>void setupLocator() async {</code><code>var instance = await PrefManager.getInstance();</code><code>locator.registerSingleton<PrefManager>(instance,signalsReady: true);</code><code>FirebaseDatabase database = FirebaseDatabase.instance;</code><code>database.setPersistenceEnabled(true);</code><code>locator.registerSingleton<DatabaseReference>(database.reference());</code><code>}</code>//Now you can easily access our prefmanger class like below:<code>locator<PrefManager>().color = 12 ;</code>If you want to see the code block properly, please check out the <a href="https://medium.com/programminghero/18-flutter-tips-tricks-to-give-birth-to-a-production-ready-app-95718e51b6be">full article on our Medium blog.</a><strong>5. Reuse Data Using the Singleton Pattern</strong>Singleton means the class has only one instance and also provides a global point of access to it. It is also an easy one to get wrong if you are not using it carefully. We need to access our ThemeColorclass (dark mode or light mode) again and again to set our theme color in widget . &#128071;<code>class ThemeColor{</code><code>// Singleton instance</code><code>static final ThemeColor _repo = new ThemeColor._();</code><code>// Singleton accessor</code><code>static ThemeColor get instance => _repo;</code><code>// A private constructor. Allows us to create instances of Repository</code><code>// only from within the Repository class itself.</code><code>ThemeColor._();</code><code>Color cardColor(){</code><code>return locator<PrefManager>().darkTheme? Color(0xff221F47):Colors.white;</code><code>}</code><code>Color containerColor(){</code><code>return locator<PrefManager>().darkTheme? Color(0xff161430):Colors.white;</code><code>}</code><code>}</code><code>ThemeColor.instance.cardColor()</code><strong>6. Avoid Widget Rebuild by Using</strong> <strong>const</strong> <strong>Constructor</strong>If you want to prevent unwanted widget rebuilds always use <strong>const</strong> constructor. In the code below, the instance of BoxDecoration will remain the same even if the setState is called.<code>Container(</code><code>width: 250,</code><code>height: 250,</code><code>decoration: const BoxDecoration(</code><code>borderRadius: BorderRadius.only(</code><code>bottomLeft:…
New post on /r/flutterdev subreddit:

Tutorial
Guys why there's no proper tutorials for flutter? I understand theres a lot of docs and YouTube videos but I'm feeling like there are there just for getting something done and there's not a real tutorial for really learning it. Deep learning is different than just watching 3+ hours of tutorials and copying it. I always feel like I don't know enough and it proves me right. After completing tons of tutorials I still need more and more help from forums or other open source projects to understand how everything works and feel lost. If there are some other ways or a good tutorials please let me know.

May 08, 2020 at 10:24PM by armen_652
https://ift.tt/35Uafh7
New post on Flutter Dev Google group:

1.17 MaterialColor changed ???
Just playing around with the default app and tried to change colors in primarySwatch, I noticed that none of the "accent" or sub colors are supported now. This works: Colors.blue or Colors.red These examples do not work: Colors.blueAccent Colors.red[200] Colors.grey.shade700 The above

May 08, 2020 at 11:28PM by jerry hamby
https://ift.tt/2SNNw0S
New post on /r/flutterdev subreddit:

Want to find a course/project that teaches how to structure a Flutter app (well)
Hey, I'm looking for a set of videos/course/tutorial that would teach production-level structure of a Flutter app (with tests, state management, stores, etc.)Anybody know of a tutorial like this?

May 09, 2020 at 02:55AM by NoteToBear
https://ift.tt/3dtmXWp