Copy and Paste  -   An Application to Copy/Paste Text  

 
S.No 5972 Name C33 Date/Time 02-Jul-2024 02:32:40 PM

Copy text from below
/*
Question C33:
We have following record of students:
RegNo Name  Marks
1 Ali 80
2 Noman 60
3 Faisal  40
4 Javed 55

You need to show the above record map function flutter’s ListView widget. Display a 4th column in the output that displays ‘pass’ if marks are greater than 50 and fail otherwise.
For example:
RegNo Name  Marks Status
1 Ali 80  Pass
2 Noman 60  Pass
3 Faisal  40  Fail
4 Javed 55  Pass
*/

import 'package:flutter/material.dart';

class Student {
  final int regno;
  final String name;
  final double marks;

  Student(this.regno, this.name, this.marks);
}

void main() {
  runApp(MaterialApp(title: 'Flutter Demo', home: MyApp()));
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final List<Student> students = [
    Student(35, "Ali", 33),
    Student(15, "Nasir", 63),
    Student(20, "Javed", 20),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
            padding: const EdgeInsets.all(20),
            child: ListView.builder(
                itemCount: students.length,
                itemBuilder: (context, index) {
                  final item = students[index];

                  return ListTile(
                      subtitle: Row(children: [
                    Expanded(child: Text("${item.regno}")),
                    Expanded(child: Text(item.name)),
                    Expanded(child: Text("${item.marks}")),
                    Expanded(
                        child: Text("${item.marks >= 50 ? "Pass" : "Fail"}")),
                  ]));
                })));
  }
}




comments powered by Disqus
NEW ENTRIES
S.No Name Entry Time/Date
5827 q4 10-Oct-2023 05:40:56 PM
5826 jflex q3 10-Oct-2023 05:37:43 PM
5825 q3 10-Oct-2023 05:33:13 PM
5824 q2 10-Oct-2023 05:32:15 PM
5823 jflex 10-Oct-2023 05:30:32 PM
5822 dddd 10-Oct-2023 04:41:21 PM
5821 nn 09-Oct-2023 11:55:27 AM
5820 Jarvo 09-Oct-2023 11:44:19 AM
5819 NEW CHILD 07-Oct-2023 11:16:57 AM
5818 05-Oct-2023 06:32:33 PM
5817 LandscapeLay 05-Oct-2023 11:42:00 AM
5813 responsive 02-Oct-2023 11:44:41 AM
5806 lab task 26-Sep-2023 05:28:21 PM
5805 q 4 26-Sep-2023 05:19:19 PM
5804 111 26-Sep-2023 04:45:42 PM
5803 comp 26-Sep-2023 04:14:07 PM
5802 COlor 25-Sep-2023 03:03:06 PM
5801 islamabad 25-Sep-2023 02:56:47 PM
5800 Ikack 25-Sep-2023 02:27:21 PM
5799 Blue Green n 25-Sep-2023 02:01:07 PM
5798 Jask 25-Sep-2023 01:59:04 PM
5797 Blue Green 25-Sep-2023 01:59:02 PM
5796 fire-wood-wa 25-Sep-2023 12:49:39 PM
5795 6001 25-Sep-2023 11:54:34 AM
5794 23-Sep-2023 08:28:04 PM
5793 Child Hot 22-Sep-2023 11:53:03 AM
5792 dfd 22-Sep-2023 10:42:45 AM
5791 Codeeee 22-Sep-2023 09:44:28 AM
5790 HEC 22-Sep-2023 09:41:20 AM
5789 llllllllll 22-Sep-2023 09:20:11 AM

[First] [Prev] 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 [Next] [Last]
 
web counter
web counter


To report any error messages or bugs, or other issues, please send email at: info@pakproject.com