membuat aplikasi kuis part VII

Beranda › Forums › Belajar Flutter Mobile Apps Tingkat Pemula › membuat aplikasi kuis part VII

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #190776
    albert.s
    Participant

      halo coach mau nanya nih ada muncul eror mau posting screenshoot ga bisa jadi ini saya ketikan aja erornya di bagian yang saya bold “handlePilih”

      import ‘package:flutter/material.dart’;

      class jawaban extends StatelessWidget {
      // const MyWidget({super.key});

      Function handlePilih;
      jawaban(this.handlePilih);

      @override
      Widget build(BuildContext context) {
      return Container(
      width: double.infinity,
      child: ElevatedButton(
      onPressed: handlePilih, //muncul eror The argument type ‘Function’ can’t be assigned to the parameter type ‘void Function()?’.dartargument_type_not_assignable”

      style: ElevatedButton.styleFrom(
      primary: Colors.grey,
      ),
      child: Text(‘jawaban 1’),
      ),
      );
      }
      }

      #191021
      Anonymous

        sepertinya berbeda dari ini ya

        import 'package:flutter/material.dart';
        
        class Jawaban extends StatelessWidget {
          final Function handlePilih;
          final String jawabanText;
        
          Jawaban(this.handlePilih, this.jawabanText);
        
          @override
          Widget build(BuildContext context) {
            return Container(
              width: double.infinity,
              child: ElevatedButton(
                onPressed: handlePilih,
                style: ElevatedButton.styleFrom(
                  primary: Colors.blue,
                ),
                child: Text('jawaban1'),
              ),
            );
          }
        }
        
        #191649
        albert.s
        Participant

          done, coach thankyou

          #191819
          Anonymous

            oke sama sama

            #197306
            Haerul Nurdiana
            Participant

              sama saya juga tidak bisa coach

              import ‘package:flutter/material.dart’;

              class Jawaban extends StatelessWidget {
              // const Jawaban({super.key});
              Function handlePilih;

              Jawaban(this.handlePilih);

              @override
              Widget build(BuildContext context) {
              return Container(
              child: ElevatedButton(onPressed: handlePilih, child: Text(‘Jawaban 1’)), //handlePilih error
              );
              }
              }

              #197536
              Anonymous

                kalau masalah ada dimananya ya ?

                #205048
                raynhardtarihoran11
                Participant

                  “message”: “The argument type ‘Function’ can’t be assigned to the parameter type ‘void Function()?’.”,

                  ada garis merah dibagian handlePilih untuk onPressed coach

                  #205329
                  Anonymous

                    function handlenya tidak terpanggil dari page sebelumnya boleh dicheck ?

                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • You must be logged in to reply to this topic.
                  Shopping cart0
                  There are no products in the cart!
                  Continue shopping