Skip to main content

mad

1. ScrollView.

Definition: A ScrollView in Flutter allows the user to scroll through a single child widget.

Types:

SingleChildScrollView: Used for scrolling a single child element.

ListView: Used for displaying a scrollable list of items.

Common Properties:

scrollDirection: Specifies the scrolling axis (Axis.vertical or Axis.horizontal).

reverse: Reverses the scrolling direction.

padding: Adds padding to the content.

SingleChildScrollView( child: Column( children: [ Text("Item 1"), Text("Item 2"), // Add more widgets here ], ), )

2. ListView

Theory (Short Questions)

  • ListView

    A scrollable widget in Flutter that displays a list of items vertically or horizontally. It is highly customizable and supports different constructors for various use cases.

    ListView()

    The simplest constructor for creating custom lists manually. Ideal for small, static lists of widgets.

    ListView.builder

    Efficient for large datasets as it builds items only when needed. Reduces memory usage by creating widgets on-demand.

    ListView.separated

    Adds a separator widget between list items for better organization. Useful for visually distinguishing list elements.

    ListView.custom

    Allows creating advanced lists with custom behaviors. Offers flexibility to design unique scrolling experiences.



ListView.builder(
  itemCount: 10,
  itemBuilder: (context, index) {
    return ListTile(
      title: Text("Item $index"),
    );
  },
)

ListTile

A widget in Flutter that creates a single fixed-height row. It includes optional leading and trailing widgets, along with a title and subtitle.

leading

Displays a widget, like an icon or avatar, before the title.

title

The primary content of the tile, typically a text widget.

trailing

Shows a widget, like an icon or button, after the title for additional actions.


subtitle

Displays additional information below the title, often in smaller text.

ListTile( leading: Icon(Icons.person), title: Text("John Doe"), subtitle: Text("Flutter Developer"), trailing: Icon(Icons.arrow_forward), )




CircleAvatar

Theory (Short Questions)

  • Definition: The CircleAvatar widget in Flutter is primarily used for displaying circular profile pictures, icons, or other content in a circular shape.
  • Common Properties:
    • backgroundColor: Sets the background color of the avatar.
    • backgroundImage: Allows an image to be placed inside the avatar, typically sourced from the network or assets.
    • child: Places a widget (like text or icons) at the center of the avatar.


CircleAvatar( radius: 50, backgroundColor: Colors.purple, child: Text( 'A', style: TextStyle(fontSize: 24, color: Colors.white), ), );





















long: import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Named Routes Example', // Define named routes routes: { '/': (context) => FirstScreen(), '/second': (context) => SecondScreen(), }, initialRoute: '/', ); } } class FirstScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('First Screen'), ), body: Center( child: ElevatedButton( onPressed: () { // Navigate to the Second Screen and pass data Navigator.pushNamed( context, '/second', arguments: 'Hello from the First Screen!', ); }, child: Text('Go to Second Screen'), ), ), ); } } class SecondScreen extends StatelessWidget { @override Widget build(BuildContext context) { // Retrieve data passed from the First Screen final String data = ModalRoute.of(context)!.settings.arguments as String; return Scaffold( appBar: AppBar( title: Text('Second Screen'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( data, style: TextStyle(fontSize: 20), ), SizedBox(height: 20), ElevatedButton( onPressed: () { // Navigate back to the First Screen Navigator.pop(context); }, child: Text('Go Back to First Screen'), ), ], ), ), ); } }

Comments

Popular posts from this blog

Chap#10

Network topologies Definition: Network topologies define how nodes (processors/computers) are interconnected in parallel and distributed systems. The choice of topology affects performance, scalability, and cost. Key Metrics: Degree: Number of links per node. (Formula: deg = connections per node) Example: In a linear array, each node (except ends) has 2 links. Diameter: Longest shortest path between any two nodes. (Formula: diam = max distance) Example: Linear array with 8 nodes has diameter 7 (P₀ to P₇). Bisection Width: Minimum links to cut to split the network into two halves. (Formula: bw = min cuts) Example: Binary tree has bw=1 (cutting the root disconnects it).4 1. Linear Array Define : Nodes are connected one after another in a straight line. Each node (except the ends) connects to two neighbors one on the left and one on the right. Explanation : Simple to build and easy to understand, but not efficient for large networks. Long distance between farthest nodes makes comm...
Asymmetric-key algorithms are algorithms used in cryptography that use two different keys  a public key for encryption and a private key for decryption. These keys are mathematically related, but the private key cannot be easily derived from the public key. Types: RSA (Rivest–Shamir–Adleman): It uses large prime numbers to generate the key pair and supports both encryption and digital signatures DSA (Digital Signature Algorithm): DSA is primarily used for creating digital signatures, ensuring the authenticity. Symmetric-key algorithms are algorithms for cryptography that use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext  Types: Stream Cipher:  Stream Cipher Converts the plain text into cipher text by taking 1 byte of plain text at a time. Block cipher: Converts the plain text into cipher text by taking plain text's block at a time DES? DES stands for Data Encryption Standard . It is a symmetric-key algorithm used to enc...

Ai Mental Health & Cyber Safety Presentation

Module A - The Normalization Engine Linguistic Challenge: Roman Urdu lacks standardized orthography (e.g., "kesa" vs "kaisa"), creating orthographic "noise" that significantly degrades the accuracy of downstream AI models. Technical Role: Acts as a Sequence-to-Sequence (Seq2Seq) transliteration and lexical normalization layer to standardize inputs before analysis. Model: A specialized transformer architecture, specifically m2m100 fine-tuned on parallel corpora or UrduParaphraseBERT. Primary Dataset: Roman-Urdu-Parl (RUP). A large-scale parallel corpus of 6.37 million sentence pairs designed to support machine transliteration and word embedding training. Link: https://arxiv.org/abs/2503.21530 Outcome: Reduces orthographic noise by achieving up to 97.44% Char-BLEU accuracy for Roman-Urdu to Urdu conversion, ensuring Module B receives high-quality "clean" data for risk analysis. Module B - Risk Stratification (BERT) Heading: The "Safety ...