Deploy Flutter Android – Stack Overflow em Português

sou novo em desenvolvimento mobile, e chegou a hora deu fazer meu primeiro deploy.
Eu estou usando flutter para desenvolver e estou tentando a bastante tempo realizar o build para android, porém estou recebendo o seguinte erro:

Keystore file not set for signing config release.

Porém, eu fiz a configuração conforme a documentação do próprio flutter:

https://flutter.dev/docs/deployment/android#signing-the-app

Aqui está minha configuração do arquivo key.properties:

inserir a descrição da imagem aqui

E a configuração do arquivo build.gradle

inserir a descrição da imagem aqui

Alguém pode me ajudar por favor?

google – type ‘Color’ is not a subtype of type ‘MaterialColor’ error in Flutter?

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _TypeError was thrown building Builder:
type ‘Color’ is not a subtype of type ‘MaterialColor’

The relevant error-causing widget was:
MaterialApp file:///D:/FlutterExercise/FlutterExercise/07/spanishaudioplayer/lib/main.dart:9:12

When the exception was thrown, this was the stack:
#0 new _HomePageState (package:spanishaudioplayer/HomePage.dart:22:35)
#1 HomePage.createState (package:spanishaudioplayer/HomePage.dart:7:35)
#2 new StatefulElement (package:flutter/src/widgets/framework.dart:4584:24)
#3 StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:916:38)
… Normal element mounting (166 frames)
#169 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#170 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6094:32)
… Normal element mounting (300 frames)
#470 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#471 Element.updateChild (package:flutter/src/widgets/framework.dart:3306:18)
#472 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1182:16)
#473 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1153:5)
#474 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:1095:18)
#475 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2647:19)
#476 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1094:13)
#477 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:934:7)
#478 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:915:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

════════════════════════════════════════════════════════════════════════════════════════════════════
W/InputMethodManager(14486): startInputReason = 8
W/IInputConnectionWrapper(14486): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(14486): getTextBeforeCursor on inactive InputConnection
V/ActivityThread(14486): Finishing stop of ActivityRecord{801579c token=android.os.BinderProxy@63e470c {com.example.spanishaudioplayer/com.example.spanishaudioplayer.MainActivity}}
W/libEGL (14486): EGLNativeWindowType 0x76efee7010 disconnect failed
W/libEGL (14486): EGLNativeWindowType 0x7713667010 disconnect failed
V/ActivityThread(14486): Handle window ActivityRecord{801579c token=android.os.BinderProxy@63e470c {com.example.spanishaudioplayer/com.example.spanishaudioplayer.MainActivity}} visibility: false

/////////////////////////////////////////////////////////////////////////////////////////////////////
//main.dart

import 'package:flutter/material.dart';
import 'HomePage.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Spanish Audio Numbers',
      theme: ThemeData(
        primarySwatch: Colors.teal,
      ),
      home: HomePage(),
    );
  }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////
//HomePage.dart

import 'package:flutter/material.dart';
import 'package:audioplayers/audio_cache.dart';
import 'NumberAudio.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  AudioCache audioPlayer = AudioCache();
  List<NumberAudio> audioList = (
    NumberAudio("one.wav", Colors.red, "one"),
    NumberAudio("two.wav", Colors.blue, "two"),
    NumberAudio("three.wav", Colors.pink, "three"),
    NumberAudio("four.wav", Colors.orange, "four"),
    NumberAudio("five.wav", Colors.purple, "five"),
    NumberAudio("six.wav", Colors.cyan, "six"),
    NumberAudio("seven.wav", Colors.green, "seven"),
    NumberAudio("eight.wav", Colors.grey, "eight"),
    NumberAudio("nine.wav", Colors.yellow, "nine"),
    NumberAudio("ten.wav", Colors.black, "ten"),
  );
  play(String audioFile) async {
    audioPlayer.play(audioFile);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Spanish Numbers',
          style: TextStyle(
            color: Colors.white,
            fontSize: 24.0,
            fontWeight: FontWeight.bold,
          ),
        ),
        //backgroundColor: Colors.teal,
      ),
      body: Center(
        child: Column(
          children: (
            Image(
              image: AssetImage("images/logo.png"),
            ),
            Expanded(
              child: GridView.builder(
                padding: EdgeInsets.all(10.0),
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                  childAspectRatio: 1.0,
                  crossAxisCount: 2,
                  crossAxisSpacing: 5.0,
                  mainAxisSpacing: 5.0,
                ),
                itemCount: audioList.length,
                itemBuilder: (context, index) => SizedBox(
                  height: 50.0,
                  width: 100.0,
                  child: RaisedButton(
                    child: Text(
                      audioList(index).buttonTitle,
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 24.0,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    color: audioList(index).buttonColor,
                    onPressed: () {
                      play(audioList(index).audioFile);
                    },
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////
//NumberAudio.dart

import 'package:flutter/material.dart';

class NumberAudio {
  String audioFile;
  MaterialColor buttonColor;
  String buttonTitle;
  NumberAudio(String audioFile, MaterialColor buttonColor, String buttonTitle) {
    this.audioFile = audioFile;
    this.buttonColor = buttonColor;
    this.buttonTitle = buttonTitle;
  }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////

audio files are in the assets folder and the logo is in images folder.

firebase – Check authentication state using stream not working in Flutter

I’m using GoogleSignIn.

On my splash screen, I’m using StreamBuilder to check whether the user is logged in or not, and based on that data I’m trying to show the Login Screen or Home Screen.

When I uninstall and reinstall the app it shows the Login Screen for the first time. And then after it always shows me the Home Screen even if I logged out from the app.

Below is my code for Splash Screen:

class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  @override
  Widget build(BuildContext context) {
    SizeConfig().init(context);
    return StreamBuilder(
      stream: FirebaseAuth.instance.authStateChanges(),
      builder: (BuildContext context, AsyncSnapshot<User> snapshot) {
        if (snapshot.hasData) {
          print(snapshot.hasData);
          return AnimatedSplashScreen(
            splashIconSize: SizeConfig.blockSizeVertical * 16,
            splashTransition: SplashTransition.fadeTransition,
            nextScreen: HomeScreen(),
            splash: kLogoImage,
            duration: 800,
          );
        } else {
          print(snapshot.hasData);
          return AnimatedSplashScreen(
            splashIconSize: SizeConfig.blockSizeVertical * 16,
            splashTransition: SplashTransition.fadeTransition,
            nextScreen: LoginScreen(),
            splash: kLogoImage,
            duration: 800,
          );
        }
      },
    );
  }
}

Below is my code for Home Screen:

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final GoogleSignIn googleSignIn = GoogleSignIn();
  User firebaseUser;

  signOut() async {
    await googleSignIn.signOut();
    Navigator.pushReplacementNamed(context, MyRoutes.loginScreen);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: (
          Center(
            child: Text('Hello'),
          ),
          MaterialButton(
              child: Text('Log out'),
              color: Colors.red,
              onPressed: () {
                signOut();
              })
        ),
      ),
    );
  }
}

android layout – Flutter ListView: Only one item name on the list is called when onDismissed

I am using a ListView.Builder to display my data to the screen which is working very fine, then i implimented the Dismisse and onDismisse function which seem to be working fine but it i try to dismisse item-A it will dismiss it from the screen but on the showSnackBar its displaying that Item-Z was deleted, if i deleted item-B it still gives me the name of of item-Z on the showSnackBar, i added more items to the data List which made item-Z now item-X but if i swipe its still shows me that the new item-Z has been deleted, then i tried deleting the Last Item which is the item-Z and it gave me an error

(. Exception caught by animation library
═════════════════════════════════ The following RangeError was thrown
while notifying listeners for AnimationController:
RangeError (index): Invalid value: Not in inclusive range 0..3: 4

When the exception was thrown, this was the stack
#0 List.() (dart:core-patch/growable_array.dart:177:60)
#1 _ListsState.build.. package:another_test/list_widget.dart:81. )

this is the code down bellow

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import './list_model.dart';

class Lists extends StatefulWidget {
  @override
  _ListsState createState() => _ListsState();
}

class _ListsState extends State<Lists> {
  List<ItemLists> items = (
    ItemLists(
      title: 'Best Music of the Year',
      discription: 'Davido',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Album Cover design',
      discription: 'Brighter Press',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Vocalist',
      discription: 'Simi-Sola',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Danced',
      discription: 'Black Camaru',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Performance',
      discription: 'Shofeni-Were',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Act',
      discription: 'You Want to See Craze',
      favorite: false,
    ),
  );

  @override
  Widget build(BuildContext context) {
    return Container(
      child: ListView.builder(
        scrollDirection: Axis.vertical,
        shrinkWrap: true,
        itemBuilder: (context, index) {
          return Dismissible(
            key: ObjectKey(items(index)),
            background: Container(
              color: Colors.red,
            ),
            child: Card(
                child: ListTile(
              leading: new IconButton(
                  icon: Icon(
                    Icons.star,
                    color: items(index).favorite ? Colors.green : Colors.grey,
                  ),
                  tooltip: 'Add to Favorite',
                  onPressed: () {
                    setState(() {
                      items(index).favorite = !items(index).favorite;
                    });
                  }),
              title: Text('${items(index).title}'),
              subtitle: Text('${items(index).discription}'),
              trailing:
                  IconButton(icon: Icon(Icons.calendar_today), onPressed: null),
            )),
            onDismissed: (direction) {
              // Remove the item from the data source.
              setState(() {
                items.removeAt(index);
              });
              Scaffold.of(context).showSnackBar(
                SnackBar(
                  content: Text('${items(index)?.title} Deleted'),
                ),
              );
            },
          );
        },
        itemCount: items.length,
      ),
    );
  }
}

and the data model code down bellow

class ItemLists {
  String title;
  String discription;
  bool favorite;

  ItemLists({this.title, this.discription, this.favorite});
}

from the screenshoot bellow you will see i deleted a different item but it was still showing me that i deleted the last item which is still on the page

enter image description here

flutter – Consigo colocar mais de 2 imagens na Native Splash Screen?

Tenho um projeto onde uma imagem seria meu background, uma seria um logotipo centralizado na tela e uma outra que ficaria na parte de baixo da tela. Eu consigo fazer isso no Native Splash Screen ou teria outra forma de fazer isso? Consegui fazer a Splash Screen com as duas primeiras imagens com o Native porém não consigo adicionar a terceira imagem. Exemplo de como deve ficar:

Imagem de como deve ficar:

Flutter Horizontal ListView with Sticky Headers

How can I built a horizontal ListView with Sticky Headers like the following in Flutter?

example

For this example I used the sticky_infinite_list package. The problem is that it has no grouping built in, so I had to place a ListView/Row inside contentBuilder. This leads to bad performance, because the whole ListView/Row is rendered as soon as the beginning of it enters the cache area.

flutter – erro ao enviar e-mail pacote flutter_email_sender

Bom dia a todos, estou fazendo um site no Flutter, mas na área de de contato por email estou com problema ao utilizar o pacote flutter_email_sender, na qual quando preencho o formulário e envio a mensagem, aparece o seguinte erro:

Console:

email - > xxxx@gmail.com  message -> hellooo
Error: MissingPluginException(No implementation found for method send on channel flutter_email_sender)
    at Object.throw_ (as throw) (http://localhost:58166/dart_sdk.js:5334:11)
    at MethodChannel._invokeMethod (http://localhost:58166/packages/flutter/src/services/system_channels.dart.lib.js:954:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:58166/dart_sdk.js:39032:33
    at _RootZone.runUnary (http://localhost:58166/dart_sdk.js:38889:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:58166/dart_sdk.js:33875:29)
    at handleValueCallback (http://localhost:58166/dart_sdk.js:34435:49)
    at Function._propagateToListeners (http://localhost:58166/dart_sdk.js:34473:17)

A implementação do site é a seguinte:

import 'package:flutter/material.dart';
import 'package:flutter_email_sender/flutter_email_sender.dart';

class ContactView extends StatefulWidget {
  @override
  _ContactViewState createState() => _ContactViewState();
}

class _ContactViewState extends State<ContactView> {
  var _emailFormKey = GlobalKey<FormState>();

  TextEditingController nameController = new TextEditingController();
  TextEditingController emailController = new TextEditingController();
  TextEditingController messageController = new TextEditingController();

  String value;

  @override
  Widget build(BuildContext context) {
    return Column(children: (
//Header page
      Padding(
        padding: EdgeInsets.only(left: 15.0),
        child: Text(
          "Contact",
          style:
              TextStyle(fontWeight: FontWeight.w800, height: 3.0, fontSize: 24),
        ),
      ),
      SizedBox(
        height: 30,
      ),
    //Enter Forms
      Form(
          key: _emailFormKey,
          child: Column(
            children: (
              Container(
                  margin: EdgeInsets.only(top: 50, left: 15, right: 15),
                  child: TextFormField(
                    controller: nameController,
    //Validator name
                    validator: (value) {
                      if (value.isEmpty) {
                        return 'please Enter your name';
                      }
                    },
                    decoration: InputDecoration(
                        labelText: "Enter name",
                        border: OutlineInputBorder(
                            borderSide:
                                BorderSide(color: Colors.black54, width: 2))),
                  )),
              Container(
                  margin: EdgeInsets.only(top: 50, left: 15, right: 15),
                  child: TextFormField(
                    controller: emailController,
    //Validator email
                    validator: (value) {
                      if (value.isEmpty) {
                        return 'please Enter email';
                      }
                    },
                    decoration: InputDecoration(
                        labelText: "Enter email",
                        border: OutlineInputBorder(
                            borderSide:
                                BorderSide(color: Colors.black54, width: 2))),
                  )),
              Container(
                  margin: EdgeInsets.only(top: 50, left: 15, right: 15),
                  child: TextFormField(
                    controller: messageController,
    //Validator message
                    validator: (value) {
                      if (value.isEmpty) {
                        return "please Enter message";
                      }
                    },
                    decoration: InputDecoration(
                        labelText: "Enter message",
                        border: OutlineInputBorder(
                            borderSide:
                                BorderSide(color: Colors.black54, width: 2))),
                  )),
              Container(
                margin: EdgeInsets.only(top: 15),
                child: RaisedButton(
                    child: Text("Send"),
                    onPressed: () {
                      if (_emailFormKey.currentState.validate()) {
                        sendMessage();
                      }
                    }),
              )
            ),
          ))
    ));
  }


//Function to send message
  void sendMessage() {
    String inputName;
    String inputEmail;
    String inputMessage;
    Email email;
    setState(() {
      inputEmail = emailController.text;
      inputMessage = messageController.text;
      inputName = nameController.text;
      if (inputMessage.isNotEmpty &&
          inputEmail.isNotEmpty &&
          inputName.isNotEmpty) {
       //package flutter_email_sender
        email = Email(
          body: inputMessage,
          subject: inputName,
          recipients: ('xxx@gmail.com'),
          isHTML: false,
        );
        send(email);
      }
    });
    debugPrint('email - > $inputEmail  message -> $inputMessage');
  }

  void send(Email email) async {
    await FlutterEmailSender.send(email);
  }
}

Neste sentido, gostaria de saber se alguém já passou por este erro ou tem alguma ideia de como resolvê-lo a partir desta implementação, estive pensando se está relacionado ao site ainda não está hospedado. Agradeço desde já quem auxiliar na resolução!!