Posts

Dice Roller App

Image
 Main.dart                         // 1st file import   'package:flutter/material.dart' ; import   'HomePage.dart' ; void   main ()  =>  runApp ( MyApp ()); class   MyApp   extends   StatelessWidget   {    @override    Widget   build ( BuildContext   context )   {      return   MaterialApp (        title :   'Dice Roller' ,        debugShowCheckedModeBanner :   false ,        theme :   ThemeData ( primarySwatch :   Colors . yellow ),        home :   HomePage (),      );    } } HomePage.dart               // 2nd file import   'package:flutter/material.dart' ; import   'dart:math' ; ...

Background Color Changer

Image
  import   'package:flutter/material.dart' ; import   'dart:math' ; void   main ()  =>  runApp ( MyApp ()); class   MyApp   extends   StatelessWidget   {    @override    Widget   build ( BuildContext   context )   {      return   MaterialApp (          title :   'Background Changer' ,          debugShowCheckedModeBanner :   false ,          theme :   ThemeData . dark (),          home :   Scaffold (            appBar :   AppBar (              title :   Text ( 'Random BG' ),            ),      ...

Stateful Widget

Image
  import   'package:flutter/material.dart' ; void   main ()   {    runApp ( MaterialApp (      home :   MyButton (),    )); } class   MyButton   extends   StatefulWidget   {    @override    MyButtonState   createState ()   {      return   MyButtonState ();    } } class   MyButtonState   extends   State < MyButton >   {    int   counter   =   0 ;    List < String >   num   =   [      "uno" ,      "dos" ,      "tres" ,      "cuatro" ,      "cinco" ,      "seis" ,      "seite" ,      "ocho" ,      "nueve" ,      "dietz"    ];    String   def...

Stateless widget

Image
  import   'package:flutter/material.dart' ; void   main ()   {    runApp ( MyApp ()); } class   MyApp   extends   StatelessWidget   {    @override    Widget   build ( BuildContext   context )   {      return   MaterialApp (        title :   'Flutter App' ,        debugShowCheckedModeBanner :   false ,        theme :   ThemeData (          primaryColor :   Colors . green ,          accentColor :   Colors . yellow ,        ),        home :   Scaffold (          appBar :   AppBar (            title :   Text ( 'Flutter' ), ...

How to make a toast

  Creating a TOAST has three ways: - 1. Add this in XML – android :onClick ="show"   Main Activity – fun show (view: View) {     Toast.makeText( this, "Button is clicked" , Toast. LENGTH_SHORT ).show() }   2. override fun onClick (v: View) {     Toast.makeText(v. context , "Button is clicked on interface function" , Toast. LENGTH_LONG ).show() }  

How to call Implicit Intent

Image
  ACTIVITY MAIN.XML <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context=".MainActivity">     <ImageView         android:id="@+id/ivPhoto"         android:layout_width="270dp"         android:layout_height="450dp"         android:layout_margin="20dp"         android:scaleType="centerCrop"         app:layout_constraintBottom_toTopOf="@+id/btnchoose"         app:layout_constraintEnd_toEndOf="parent"         app:layout_constraintHorizontal_bias="0.496" ...