How to dynamically resize text in Flutter?

You can use FittedBox to manage text based on height or width. For Ex. Simply just wrap your Text widget to FittedBox widget like, Here I want to resize my AppBar text based on width. AppBar( centerTitle: true, title: FittedBox( fit: BoxFit.fitWidth, child: Text(‘Hey this is my long text appbar title’) ), ), Text will … Read more

Generate SHA-1 for Flutter/React-Native/Android-Native app

TERMINAL Go to the project folder in the terminal. Mac keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android Windows keytool -list -v -keystore “\.android\debug.keystore” -alias androiddebugkey -storepass android -keypass android Linux keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android GUI Android Studio. Select android/app/build.gradle file and on the right … Read more

What is the relation between stateful and stateless widgets in Flutter?

A StatelessWidget will never rebuild by itself (but can from external events). A StatefulWidget can. That is the golden rule. BUT any kind of widget can be repainted any times. Stateless only means that all of its properties are immutable and that the only way to change them is to create a new instance of … Read more

How do I do the “frosted glass” effect in Flutter?

You can use the BackdropFilter widget to achieve this effect. import ‘dart:ui’; import ‘package:flutter/material.dart’; void main() { runApp(new MaterialApp(home: new FrostedDemo())); } class FrostedDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( body: new Stack( children: <Widget>[ new ConstrainedBox( constraints: const BoxConstraints.expand(), child: new FlutterLogo() ), new Center( child: new ClipRect( child: … Read more

How to change background color of Elevated Button in Flutter from function?

You can style ElevatedButton by using the styleFrom static method or the ButtonStyle class. The first one is more convenience than the second one. Using styleFrom to style an ElevatedButton: ElevatedButton( child: Text(‘Button’), onPressed: () {}, style: ElevatedButton.styleFrom({ Color primary, // set the background color Color onPrimary, Color onSurface, Color shadowColor, double elevation, TextStyle textStyle, … Read more

Flutter get context in initState method

The member variable context can be accessed during initState but can’t be used for everything. This is from the flutter for initState documentation: You cannot use [BuildContext.inheritFromWidgetOfExactType] from this method. However, [didChangeDependencies] will be called immediately following this method, and [BuildContext.inheritFromWidgetOfExactType] can be used there. You could move your initialization logic to didChangeDependencies, however that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)