Giter Club home page Giter Club logo

Comments (2)

darshankawar avatar darshankawar commented on May 21, 2024 1

Thanks for the report @MilanVilov
I tried to use the code sample by removing third party package implementation but it seems to give me below error:

Screenshot 2024-04-22 at 3 52 36 PM
runnable code sample

import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
//import 'package:protokol_app/app/widgets/full_screen_circular_progress_indicator.dart';
//import 'package:protokol_app/app/widgets/wizard_button.dart';

void main() {
  runApp(MaterialApp(
    home: SupportAndFeedback(),
  ));
}

class SupportAndFeedback extends StatefulWidget {
  @override
  SupportAndFeedbackState createState() => SupportAndFeedbackState();
}

class SupportAndFeedbackState extends State<SupportAndFeedback> {
  final _messageController = TextEditingController();
  bool _isLoading = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    _messageController.dispose();
    super.dispose();
  }

  void _navigateToLandingScreen() {
    Navigator.pop(context, true);
  }

  void _handleSendButtonPressed() {
    setState(() {
      _isLoading = true;
    });

    // Simulate a delay of 1 second using a Future
    Future.delayed(Duration(seconds: 1), () {
      setState(() {
        _isLoading = false;
      });
      _navigateToLandingScreen();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: true,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text(
          FlutterI18n.translate(context, 'support_and_feedback'),
          style: Theme.of(context).textTheme.titleMedium,
        ),
        leading: IconButton(
          icon: const Icon(Icons.close),
          color: Colors.black,
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        elevation: 0,
      ),
      body: _isLoading
          ? CircularProgressIndicator()
          : Padding(
        padding:
        const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            TextField(
              style: Theme.of(context).textTheme.bodyMedium,
              controller: _messageController,
              decoration: InputDecoration(
                hintText: FlutterI18n.translate(context, 'enter_message'),
                border: InputBorder.none,
                contentPadding: const EdgeInsets.all(0),
              ),
              maxLines: 12,
              maxLength: 500,
              keyboardType: TextInputType.multiline,
            ),
          ],
        ),
      ),
      floatingActionButton: _isLoading
          ? null
          : WizardButton(
        text: FlutterI18n.translate(context, 'send'),
        onPressed: _handleSendButtonPressed,
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
    );
  }
}

class WizardButton extends StatefulWidget {
  final VoidCallback onPressed;
  final String? text;

  const WizardButton({Key? key, required this.onPressed, this.text})
      : super(key: key);

  @override
  _WizardButtonState createState() => _WizardButtonState();
}

class _WizardButtonState extends State<WizardButton> {
  @override
  Widget build(BuildContext context) {
    double screenWidth = MediaQuery.of(context).size.width;

    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 16.0),
      child: SizedBox(
        width: screenWidth - 32,
        height: 56,
        child: FloatingActionButton(
            onPressed: widget.onPressed,
            backgroundColor: Colors.black,
            foregroundColor: Colors.white,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20.0),
            ),
            child: Text(
                widget.text == null
                    ? FlutterI18n.translate(context, 'next')
                    : widget.text!,
                style: Theme.of(context).textTheme.titleMedium!.copyWith(
                  color: Colors.white,
                ))),
      ),
    );
  }
}

Please check the same and provide only minimal but complete runnable code to verify this further.
Also, is this only occuring on simulators only or on physical device too ?

from flutter.

github-actions avatar github-actions commented on May 21, 2024

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.