GENERATE QR CODE USING QRIOUS LIBRARY

 From our Module:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Qr code</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
      h2 {
        color: black;
        text-align: center;
      }
    </style>
    <script src = "https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
  </head>
    <h2>UI QR Code Basic Generator<h2>
    <input type="text" id="qr-code-value" placeholder="Enter a text or URL" value="https://www.google.com">
    <button onclick="generateQRCode()"> Generate QR code</button> <br/>
    <img id="qr-code-image" alt="QR code">


    <script>
      function generateQRCode() {
        // Get the value entered by the user
        const value = document.getElementById('qr-code-value').value;
        // Set the options for the QR code in dictionary format
        const options = {
        value: value, // The text or URL to encode in the QR code
        size: 400, // The size of the QR code in pixels
        level: 'H' // The error correction level of the QR code
        };
        // Create a new QR code object
        const qrCode = new QRious(options);
        // Get the QR code image as a data URL
        const qrCodeImage = qrCode.toDataURL();
        // Display the QR code image on the webpage
        // you can assign your default image here
        document.getElementById('qr-code-image').src = qrCodeImage;
      }
    </script>
  </body>
</html>

FLUTTER : DISPLAY LIST OF MAPS IN A LISTVIEW

 Code used in the video:

import 'package:flutter/material.dart';
import 'package:lessons/widget_creator.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _schoolIdController = TextEditingController();
  TextEditingController _nameController = TextEditingController();
  TextEditingController _courseController = TextEditingController();

  List<Map<String, dynamic>> _studentList = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Column(
            children: [
              createHeaders("Flutter University hehehe", "Working with Maps"),
              vSpacer(10.0),
              createTextField(
                  controller: _schoolIdController, labelText: "School ID"),
              vSpacer(10.0),
              createTextField(controller: _nameController, labelText: "Name"),
              vSpacer(10.0),
              createTextField(
                  controller: _courseController, labelText: "Course"),
              vSpacer(10.0),
              ElevatedButton(
                onPressed: () {
                  saveRecord(_schoolIdController.text, _nameController.text,
                      _courseController.text);
                },
                style: ElevatedButton.styleFrom(backgroundColor: Colors.green),
                child: const Text(
                  "Save",
                  style: TextStyle(
                    color: Colors.white,
                  ),
                ),
              ),
              //listview
              Expanded(
                child: createListview(),
              ),
            ],
          ),
        ),
      ),
    );
  }

  void saveRecord(String schoolId, String name, String course) {
    // declare the map
    Map<String, dynamic> _studentMap = {
      "schoolId": schoolId,
      "name": name,
      "course": course
    };
    // assign values to the map
    // _studentMap["schoolId"] = schoolId;
    // _studentMap["name"] = name;
    // _studentMap["course"] = course;
    // add the map to the list
    setState(() {
      _studentList.add(_studentMap);
      _studentList.sort((a, b) => a["name"].compareTo(b["name"]));
    });
    // print the list
    // print(_studentList);
    // print(_studentList[0]["name"]);
  }

  Widget createListview() {
    return ListView.builder(
      itemCount: _studentList.length,
      itemBuilder: (context, index) {
        return Card(
          child: ListTile(
            title: Text(_studentList[index]["name"]),
            subtitle: Text(_studentList[index]["course"]),
            trailing: IconButton(
                onPressed: () {
                  displaySelected(index);
                },
                icon: const Icon(Icons.arrow_right)),
          ),
        );
      },
    );
  }

  void displaySelected(int index) {
    String name = _studentList[index]["name"];
    String course = _studentList[index]["course"];
    String id = _studentList[index]["schoolId"];

    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("You selected $name of $course with ID $id"),
      ),
    );
  }
}






FLUTTER - MAPS AND LISTS

 Code used in the video:

main.dart

import 'package:flutter/material.dart';
import 'package:lessons/widget_creator.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _schoolIdController = TextEditingController();
  TextEditingController _nameController = TextEditingController();
  TextEditingController _courseController = TextEditingController();

  List<Map<String, dynamic>> _studentList = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Column(
            children: [
              createHeaders("Flutter University hehehe", "Working with Maps"),
              vSpacer(10.0),
              createTextField(
                  controller: _schoolIdController, labelText: "School ID"),
              vSpacer(10.0),
              createTextField(controller: _nameController, labelText: "Name"),
              vSpacer(10.0),
              createTextField(
                  controller: _courseController, labelText: "Course"),
              vSpacer(10.0),
              ElevatedButton(
                onPressed: () {
                  saveRecord(_schoolIdController.text, _nameController.text,
                      _courseController.text);
                },
                style: ElevatedButton.styleFrom(backgroundColor: Colors.green),
                child: const Text(
                  "Save",
                  style: TextStyle(
                    color: Colors.white,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  void saveRecord(String schoolId, String name, String course) {
    // declare the map
    Map<String, dynamic> _studentMap = {
      "schoolId": schoolId,
      "name": name,
      "course": course
    };
    // assign values to the map
    // _studentMap["schoolId"] = schoolId;
    // _studentMap["name"] = name;
    // _studentMap["course"] = course;
    // add the map to the list
    _studentList.add(_studentMap);
    // print the list
    print(_studentList);
    print(_studentList[0]["name"]);
  }
}


widget_creator.dart

Widget createTextField(
    {required TextEditingController controller,
    bool obscureText = false,
    required String labelText}) {
  return TextField(
    controller: controller,
    obscureText: obscureText,
    decoration: InputDecoration(
      labelText: labelText,
      border: OutlineInputBorder(
        borderSide: const BorderSide(
          width: 1,
          color: Colors.blue,
        ),
        borderRadius: BorderRadius.circular(
          5.0,
        ),
      ),
    ),
  );
}





UNITY: USING FIREBALL TO ELIMINATE ENEMIES

 Code user in the video:

Fireball Controller

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FireballController : MonoBehaviour {
  Transform player;
  Rigidbody2D rb;
  float speed = 400.0f;
  float direction = 1;

  // Use this for initialization
  void Start () {
    rb= GetComponent<Rigidbody2D>();
    player = GameObject.Find("Player").transform;

    if(player.localScale.x == -1){
      direction = -1;
    }
  }
 
  // Update is called once per frame
  void Update () {
    rb.velocity = new Vector2(direction * speed * Time.deltaTime, rb.velocity.y);
  }

  private void OnCollisionEnter2D(Collision2D other) {
    if(other.gameObject.tag == "Enemy"){
      other.transform.localScale = new Vector2(1, -1);
      other.transform.GetComponent<BoxCollider2D>().enabled = false;

      Destroy(other.gameObject, 2.0f);
    }
    //remove/destroy the fireball
    Destroy(gameObject);
  }
}



Player Controller

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Player : MonoBehaviour {
  Rigidbody2D playerRB;
  BoxCollider2D playerCollider;

  float moveSpeeed = 200.0f;
  float direction;

  float jumpHeight = 8.0f;
  LayerMask groundLayer;
  bool playerIsGrounded = false;
  bool doubleJumped = false;
  AudioSource[] audioSources;
  Animator playerAnimator;

  [SerializeField] GameObject fireball;
  [SerializeField] Transform firePoint;

  // Use this for initialization
  void Start () {
    playerRB = GetComponent<Rigidbody2D>();
    playerCollider = GetComponent<BoxCollider2D>();
    groundLayer = LayerMask.GetMask("Ground");
    audioSources = GetComponents<AudioSource>();
    playerAnimator = GetComponent<Animator>();
  }

  private void FixedUpdate() {
    playerIsGrounded = Physics2D.IsTouchingLayers(playerCollider, groundLayer);
  }
 
  // Update is called once per frame
  void Update () {
    direction = Input.GetAxisRaw("Horizontal");
    move(direction);

    // JUMP ROUTINE
    if(playerIsGrounded){
      doubleJumped = false;
    }
    //for the first jump
    if(Input.GetKeyDown(KeyCode.Space) && playerIsGrounded){
      jump();
    }
    //for the second jump
    if(Input.GetKeyDown(KeyCode.Space) && !playerIsGrounded && !doubleJumped){
      jump();
      doubleJumped = true;
    }
    // END JUMP ROUTINE

    // =============== ANIMATIONS =============================

    playerAnimator.SetFloat("Speed", Mathf.Abs(direction));
    playerAnimator.SetBool("Grounded", playerIsGrounded);

    // =============== END ANIMATIONS =============================

    if(transform.position.y < -3){
      //game over
      SceneManager.LoadScene("GameOverScene");
    }

    if(Input.GetKeyDown(KeyCode.L)){
      //play gunshot audio
     
      //fire the fireball
      Instantiate(fireball, firePoint.position, firePoint.rotation);
    }

  }

  void move(float direction){
    if(direction == 1){
      transform.localScale = new Vector3(1, 1, 1);
    }else if(direction == -1){ //should use this condition so that the character will not always face the left
      transform.localScale = new Vector3(-1, 1, 1);
    }
    float velocity = direction * moveSpeeed * Time.deltaTime;
    playerRB.velocity = new Vector2(velocity,playerRB.velocity.y);
  }
  void jump(){
    playerRB.velocity = new Vector2(playerRB.velocity.x, jumpHeight);
    audioSources[0].Play();
  }

  private void OnCollisionEnter2D(Collision2D otherObject) {
    if(otherObject.transform.tag.Equals("Obstacle")){
      PlayAudio(1);
    }else if(otherObject.transform.tag.Equals("Enemy")) {
      PlayAudio(2);
      SceneManager.LoadScene("GameOverScene");
    }
  }

  private void OnTriggerEnter2D(Collider2D otherObject) {
    if(otherObject.transform.tag.Equals("Enemy")){
      Debug.Log("Game Over!");
    }
  }

  void PlayAudio(int index){
    StopAllAudio();
    audioSources[index].Play();
  }

  void StopAllAudio(){
    for(int i=0;i<audioSources.Length;i++){
      if(audioSources[i].isPlaying){
        audioSources[i].Stop();
      }
    }
  }


}





AI PILIPINO MUSIC

The YouTube channel  AI PILIPINO MUSIC   presents itself as a niche platform offering content that seems to span a unique blend of creativit...