daddy 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- daddy/__init__.py +28 -0
- daddy/audio_video.py +136 -0
- daddy/custom_listview.py +49 -0
- daddy/dropdown_listview.py +57 -0
- daddy/event_handling.py +130 -0
- daddy/expanded_flexible.py +63 -0
- daddy/gridview.py +51 -0
- daddy/hello_world.py +29 -0
- daddy/login_registration.py +60 -0
- daddy/menu.py +50 -0
- daddy/parent_child.py +74 -0
- daddy/stateful_lifecycle.py +79 -0
- daddy-1.0.0.dist-info/METADATA +44 -0
- daddy-1.0.0.dist-info/RECORD +16 -0
- daddy-1.0.0.dist-info/WHEEL +5 -0
- daddy-1.0.0.dist-info/top_level.txt +1 -0
daddy/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from importlib import import_module
|
|
2
|
+
|
|
3
|
+
PRACTICALS = [
|
|
4
|
+
"hello_world",
|
|
5
|
+
"stateful_lifecycle",
|
|
6
|
+
"parent_child",
|
|
7
|
+
"login_registration",
|
|
8
|
+
"menu",
|
|
9
|
+
"dropdown_listview",
|
|
10
|
+
"gridview",
|
|
11
|
+
"custom_listview",
|
|
12
|
+
"expanded_flexible",
|
|
13
|
+
"audio_video",
|
|
14
|
+
"event_handling",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
def show(name):
|
|
18
|
+
name = name.lower().replace(".py", "")
|
|
19
|
+
|
|
20
|
+
if name not in PRACTICALS:
|
|
21
|
+
print("Practical not found!")
|
|
22
|
+
print("Available practicals:")
|
|
23
|
+
for practical in PRACTICALS:
|
|
24
|
+
print("-", practical)
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
module = import_module(f".{name}", package=__name__)
|
|
28
|
+
print(module.CODE)
|
daddy/audio_video.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
// =====================================================
|
|
3
|
+
// AUDIO PLAYBACK
|
|
4
|
+
// Add dependency: audioplayers: 4.1.0
|
|
5
|
+
// Asset: assets/audio/music.mp3
|
|
6
|
+
// =====================================================
|
|
7
|
+
|
|
8
|
+
import 'package:flutter/material.dart';
|
|
9
|
+
import 'package:audioplayers/audioplayers.dart';
|
|
10
|
+
|
|
11
|
+
void main() => runApp(MaterialApp(home: Media()));
|
|
12
|
+
|
|
13
|
+
class Media extends StatefulWidget {
|
|
14
|
+
const Media({super.key});
|
|
15
|
+
|
|
16
|
+
@override
|
|
17
|
+
State<Media> createState() => _MediaState();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class _MediaState extends State<Media> {
|
|
21
|
+
final audio = AudioPlayer();
|
|
22
|
+
|
|
23
|
+
@override
|
|
24
|
+
Widget build(BuildContext context) {
|
|
25
|
+
return Scaffold(
|
|
26
|
+
appBar: AppBar(title: const Text('Media Player')),
|
|
27
|
+
body: Column(
|
|
28
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
29
|
+
children: [
|
|
30
|
+
const Text('Audio'),
|
|
31
|
+
ElevatedButton(
|
|
32
|
+
onPressed: () => audio.play(AssetSource('audio/music.mp3')),
|
|
33
|
+
child: const Text('Play Audio'),
|
|
34
|
+
),
|
|
35
|
+
const SizedBox(height: 30),
|
|
36
|
+
],
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@override
|
|
42
|
+
void dispose() {
|
|
43
|
+
audio.dispose();
|
|
44
|
+
super.dispose();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// =====================================================
|
|
50
|
+
// VIDEO PLAYBACK
|
|
51
|
+
// Add dependency: video_player: ^2.9.2
|
|
52
|
+
// Asset: assets/video/video.mp4
|
|
53
|
+
// This is a separate Flutter program.
|
|
54
|
+
// =====================================================
|
|
55
|
+
|
|
56
|
+
import 'package:flutter/material.dart';
|
|
57
|
+
import 'package:video_player/video_player.dart';
|
|
58
|
+
|
|
59
|
+
void main() {
|
|
60
|
+
runApp(const MaterialApp(
|
|
61
|
+
debugShowCheckedModeBanner: false,
|
|
62
|
+
home: VideoPage(),
|
|
63
|
+
));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class VideoPage extends StatefulWidget {
|
|
67
|
+
const VideoPage({super.key});
|
|
68
|
+
|
|
69
|
+
@override
|
|
70
|
+
State<VideoPage> createState() => _VideoPageState();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class _VideoPageState extends State<VideoPage> {
|
|
74
|
+
late VideoPlayerController controller;
|
|
75
|
+
|
|
76
|
+
@override
|
|
77
|
+
void initState() {
|
|
78
|
+
super.initState();
|
|
79
|
+
|
|
80
|
+
controller = VideoPlayerController.asset(
|
|
81
|
+
'assets/video/video.mp4',
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
controller.initialize().then((_) {
|
|
85
|
+
setState(() {});
|
|
86
|
+
}).catchError((error) {
|
|
87
|
+
debugPrint('VIDEO ERROR: $error');
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@override
|
|
92
|
+
Widget build(BuildContext context) {
|
|
93
|
+
return Scaffold(
|
|
94
|
+
appBar: AppBar(
|
|
95
|
+
title: const Text('Video Player'),
|
|
96
|
+
),
|
|
97
|
+
body: Center(
|
|
98
|
+
child: controller.value.isInitialized
|
|
99
|
+
? Column(
|
|
100
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
101
|
+
children: [
|
|
102
|
+
AspectRatio(
|
|
103
|
+
aspectRatio: controller.value.aspectRatio,
|
|
104
|
+
child: VideoPlayer(controller),
|
|
105
|
+
),
|
|
106
|
+
const SizedBox(height: 20),
|
|
107
|
+
ElevatedButton(
|
|
108
|
+
onPressed: () {
|
|
109
|
+
setState(() {
|
|
110
|
+
if (controller.value.isPlaying) {
|
|
111
|
+
controller.pause();
|
|
112
|
+
} else {
|
|
113
|
+
controller.play();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
child: Text(
|
|
118
|
+
controller.value.isPlaying
|
|
119
|
+
? 'Pause Video'
|
|
120
|
+
: 'Play Video',
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
],
|
|
124
|
+
)
|
|
125
|
+
: const CircularProgressIndicator(),
|
|
126
|
+
),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@override
|
|
131
|
+
void dispose() {
|
|
132
|
+
controller.dispose();
|
|
133
|
+
super.dispose();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
"""
|
daddy/custom_listview.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() => runApp(const MyApp());
|
|
5
|
+
|
|
6
|
+
class MyApp extends StatelessWidget {
|
|
7
|
+
const MyApp({super.key});
|
|
8
|
+
|
|
9
|
+
@override
|
|
10
|
+
Widget build(BuildContext context) {
|
|
11
|
+
List<String> students = [
|
|
12
|
+
"Rahul",
|
|
13
|
+
"Priya",
|
|
14
|
+
"Amit",
|
|
15
|
+
"Sneha",
|
|
16
|
+
"Arjun"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
return MaterialApp(
|
|
20
|
+
home: Scaffold(
|
|
21
|
+
appBar: AppBar(title: const Text("Zaid ansari 6068")),
|
|
22
|
+
body: ListView.builder(
|
|
23
|
+
itemCount: students.length,
|
|
24
|
+
itemBuilder: (context, index) {
|
|
25
|
+
return StudentWidget(name: students[index]);
|
|
26
|
+
},
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Custom Widget
|
|
34
|
+
class StudentWidget extends StatelessWidget {
|
|
35
|
+
final String name;
|
|
36
|
+
|
|
37
|
+
const StudentWidget({super.key, required this.name});
|
|
38
|
+
|
|
39
|
+
@override
|
|
40
|
+
Widget build(BuildContext context) {
|
|
41
|
+
return Card(
|
|
42
|
+
child: ListTile(
|
|
43
|
+
leading: const Icon(Icons.person),
|
|
44
|
+
title: Text(name),
|
|
45
|
+
),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
"""
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(MaterialApp(
|
|
6
|
+
home: MyApp(),
|
|
7
|
+
debugShowCheckedModeBanner: false,
|
|
8
|
+
));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class MyApp extends StatefulWidget {
|
|
12
|
+
const MyApp({super.key});
|
|
13
|
+
|
|
14
|
+
@override
|
|
15
|
+
State<MyApp> createState() => _MyAppState();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class _MyAppState extends State<MyApp> {
|
|
19
|
+
List<String> items = ["Apple", "Banana", "Mango", "Orange"];
|
|
20
|
+
String selected = "Apple";
|
|
21
|
+
|
|
22
|
+
@override
|
|
23
|
+
Widget build(BuildContext context) {
|
|
24
|
+
return Scaffold(
|
|
25
|
+
appBar: AppBar(
|
|
26
|
+
title: Text("Dropdown Example : Mohd.Shahid Ansari 123"),
|
|
27
|
+
),
|
|
28
|
+
body: Center(
|
|
29
|
+
child: Column(
|
|
30
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
31
|
+
children: [
|
|
32
|
+
DropdownButton<String>(
|
|
33
|
+
value: selected,
|
|
34
|
+
items: items.map((item) {
|
|
35
|
+
return DropdownMenuItem(
|
|
36
|
+
value: item,
|
|
37
|
+
child: Text(item),
|
|
38
|
+
);
|
|
39
|
+
}).toList(),
|
|
40
|
+
onChanged: (value) {
|
|
41
|
+
setState(() {
|
|
42
|
+
selected = value!;
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
),
|
|
46
|
+
SizedBox(height: 20),
|
|
47
|
+
Text(
|
|
48
|
+
"Selected: $selected",
|
|
49
|
+
style: TextStyle(fontSize: 20),
|
|
50
|
+
),
|
|
51
|
+
],
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
"""
|
daddy/event_handling.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(const MyApp());
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class MyApp extends StatelessWidget {
|
|
9
|
+
const MyApp({super.key});
|
|
10
|
+
|
|
11
|
+
@override
|
|
12
|
+
Widget build(BuildContext context) {
|
|
13
|
+
return MaterialApp(
|
|
14
|
+
debugShowCheckedModeBanner: false,
|
|
15
|
+
title: 'Event Handling Demo',
|
|
16
|
+
home: const EventHandlingScreen(),
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class EventHandlingScreen extends StatefulWidget {
|
|
22
|
+
const EventHandlingScreen({super.key});
|
|
23
|
+
|
|
24
|
+
@override
|
|
25
|
+
State<EventHandlingScreen> createState() =>
|
|
26
|
+
_EventHandlingScreenState();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class _EventHandlingScreenState extends State<EventHandlingScreen> {
|
|
30
|
+
String message = "Perform an action";
|
|
31
|
+
|
|
32
|
+
// Button callback
|
|
33
|
+
void showMessage() {
|
|
34
|
+
setState(() {
|
|
35
|
+
message = "Elevated Button Clicked!";
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// GestureDetector tap callback
|
|
40
|
+
void handleTap() {
|
|
41
|
+
setState(() {
|
|
42
|
+
message = "Box Tapped!";
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// GestureDetector double-tap callback
|
|
47
|
+
void handleDoubleTap() {
|
|
48
|
+
setState(() {
|
|
49
|
+
message = "Box Double-Tapped!";
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// GestureDetector long-press callback
|
|
54
|
+
void handleLongPress() {
|
|
55
|
+
setState(() {
|
|
56
|
+
message = "Box Long-Pressed!";
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@override
|
|
61
|
+
Widget build(BuildContext context) {
|
|
62
|
+
return Scaffold(
|
|
63
|
+
appBar: AppBar(
|
|
64
|
+
title: const Text("Event Handling Demo : zaid ansari 6068"),
|
|
65
|
+
),
|
|
66
|
+
|
|
67
|
+
body: Center(
|
|
68
|
+
child: Column(
|
|
69
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
70
|
+
children: [
|
|
71
|
+
|
|
72
|
+
// Display message
|
|
73
|
+
Text(
|
|
74
|
+
message,
|
|
75
|
+
style: const TextStyle(
|
|
76
|
+
fontSize: 22,
|
|
77
|
+
fontWeight: FontWeight.bold,
|
|
78
|
+
),
|
|
79
|
+
textAlign: TextAlign.center,
|
|
80
|
+
),
|
|
81
|
+
|
|
82
|
+
const SizedBox(height: 30),
|
|
83
|
+
|
|
84
|
+
// GestureDetector
|
|
85
|
+
GestureDetector(
|
|
86
|
+
onTap: handleTap,
|
|
87
|
+
onDoubleTap: handleDoubleTap,
|
|
88
|
+
onLongPress: handleLongPress,
|
|
89
|
+
|
|
90
|
+
child: Container(
|
|
91
|
+
width: 250,
|
|
92
|
+
height: 120,
|
|
93
|
+
alignment: Alignment.center,
|
|
94
|
+
color: Colors.blue,
|
|
95
|
+
child: const Text(
|
|
96
|
+
"Touch Me",
|
|
97
|
+
style: TextStyle(
|
|
98
|
+
color: Colors.white,
|
|
99
|
+
fontSize: 24,
|
|
100
|
+
),
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
|
|
105
|
+
const SizedBox(height: 30),
|
|
106
|
+
|
|
107
|
+
// ElevatedButton callback
|
|
108
|
+
ElevatedButton(
|
|
109
|
+
onPressed: showMessage,
|
|
110
|
+
child: const Text("Click Button"),
|
|
111
|
+
),
|
|
112
|
+
|
|
113
|
+
const SizedBox(height: 10),
|
|
114
|
+
|
|
115
|
+
// TextButton callback
|
|
116
|
+
TextButton(
|
|
117
|
+
onPressed: () {
|
|
118
|
+
setState(() {
|
|
119
|
+
message = "Text Button Clicked!";
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
child: const Text("Text Button"),
|
|
123
|
+
),
|
|
124
|
+
],
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
"""
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() => runApp(const MyApp());
|
|
5
|
+
|
|
6
|
+
class MyApp extends StatelessWidget {
|
|
7
|
+
const MyApp({super.key});
|
|
8
|
+
|
|
9
|
+
@override
|
|
10
|
+
Widget build(BuildContext context) {
|
|
11
|
+
return MaterialApp(
|
|
12
|
+
home: Scaffold(
|
|
13
|
+
appBar: AppBar(title: const Text("Expanded & Flexible : Mohd.Shahid Ansari 123")),
|
|
14
|
+
body: Column(
|
|
15
|
+
children: [
|
|
16
|
+
|
|
17
|
+
// Expanded
|
|
18
|
+
Expanded(
|
|
19
|
+
child: Container(
|
|
20
|
+
color: Colors.blue,
|
|
21
|
+
child: Column(
|
|
22
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
23
|
+
children: const [
|
|
24
|
+
Icon(Icons.school, size: 70, color: Colors.white),
|
|
25
|
+
SizedBox(height: 10),
|
|
26
|
+
Text(
|
|
27
|
+
"Student Details",
|
|
28
|
+
style: TextStyle(fontSize: 25, color: Colors.white),
|
|
29
|
+
),
|
|
30
|
+
Text(
|
|
31
|
+
"Name: Rahul",
|
|
32
|
+
style: TextStyle(fontSize: 18, color: Colors.white),
|
|
33
|
+
),
|
|
34
|
+
Text(
|
|
35
|
+
"Course: BSc IT",
|
|
36
|
+
style: TextStyle(fontSize: 18, color: Colors.white),
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
),
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
|
|
43
|
+
// Flexible
|
|
44
|
+
Flexible(
|
|
45
|
+
child: Container(
|
|
46
|
+
color: Colors.green,
|
|
47
|
+
child: Row(
|
|
48
|
+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
49
|
+
children: const [
|
|
50
|
+
Icon(Icons.home, size: 40, color: Colors.white),
|
|
51
|
+
Icon(Icons.person, size: 40, color: Colors.white),
|
|
52
|
+
Icon(Icons.settings, size: 40, color: Colors.white),
|
|
53
|
+
],
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
],
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
"""
|
daddy/gridview.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(MaterialApp(
|
|
6
|
+
home: MyApp(),
|
|
7
|
+
debugShowCheckedModeBanner: false,
|
|
8
|
+
));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class MyApp extends StatelessWidget {
|
|
12
|
+
MyApp({super.key});
|
|
13
|
+
|
|
14
|
+
final items = ["Apple", "Banana", "Mango", "Orange", "Grapes", "Pineapple"];
|
|
15
|
+
|
|
16
|
+
@override
|
|
17
|
+
Widget build(BuildContext context) {
|
|
18
|
+
return Scaffold(
|
|
19
|
+
appBar: AppBar(
|
|
20
|
+
title: Text("GridView Example zaid ansari 6068"),
|
|
21
|
+
),
|
|
22
|
+
body: Padding(
|
|
23
|
+
padding: EdgeInsets.all(20),
|
|
24
|
+
child: GridView.builder(
|
|
25
|
+
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
26
|
+
crossAxisCount: 2,
|
|
27
|
+
crossAxisSpacing: 10,
|
|
28
|
+
mainAxisSpacing: 10,
|
|
29
|
+
childAspectRatio: 6.5,
|
|
30
|
+
),
|
|
31
|
+
itemCount: items.length,
|
|
32
|
+
itemBuilder: (context, index) {
|
|
33
|
+
return Container(
|
|
34
|
+
color: Colors.blue,
|
|
35
|
+
child: Center(
|
|
36
|
+
child: Text(
|
|
37
|
+
items[index],
|
|
38
|
+
style: TextStyle(
|
|
39
|
+
color: Colors.white,
|
|
40
|
+
fontSize: 18,
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
"""
|
daddy/hello_world.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(const MyApp());
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class MyApp extends StatelessWidget {
|
|
9
|
+
const MyApp({super.key});
|
|
10
|
+
|
|
11
|
+
@override
|
|
12
|
+
Widget build(BuildContext context) {
|
|
13
|
+
return const MaterialApp(
|
|
14
|
+
debugShowCheckedModeBanner: false,
|
|
15
|
+
home: Scaffold(
|
|
16
|
+
body: Center(
|
|
17
|
+
child: Text(
|
|
18
|
+
'Hello World',
|
|
19
|
+
style: TextStyle(
|
|
20
|
+
fontSize: 30,
|
|
21
|
+
fontWeight: FontWeight.bold,
|
|
22
|
+
),
|
|
23
|
+
),
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
"""
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(MaterialApp(
|
|
6
|
+
home: LoginPage(),
|
|
7
|
+
debugShowCheckedModeBanner: false,
|
|
8
|
+
));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class LoginPage extends StatelessWidget {
|
|
12
|
+
LoginPage({super.key});
|
|
13
|
+
|
|
14
|
+
final formKey = GlobalKey<FormState>();
|
|
15
|
+
|
|
16
|
+
@override
|
|
17
|
+
Widget build(BuildContext context) {
|
|
18
|
+
return Scaffold(
|
|
19
|
+
appBar: AppBar(title: Text("Login Form zaid Ansari 6068")),
|
|
20
|
+
body: Padding(
|
|
21
|
+
padding: EdgeInsets.all(20),
|
|
22
|
+
child: Form(
|
|
23
|
+
key: formKey,
|
|
24
|
+
child: Column(
|
|
25
|
+
children: [
|
|
26
|
+
TextFormField(
|
|
27
|
+
decoration: InputDecoration(
|
|
28
|
+
labelText: "Email",
|
|
29
|
+
border: OutlineInputBorder(),
|
|
30
|
+
),
|
|
31
|
+
validator: (value) =>
|
|
32
|
+
value!.isEmpty ? "Enter Email" : null,
|
|
33
|
+
),
|
|
34
|
+
SizedBox(height: 15),
|
|
35
|
+
TextFormField(
|
|
36
|
+
obscureText: true,
|
|
37
|
+
decoration: InputDecoration(
|
|
38
|
+
labelText: "Password",
|
|
39
|
+
border: OutlineInputBorder(),
|
|
40
|
+
),
|
|
41
|
+
validator: (value) =>
|
|
42
|
+
value!.isEmpty ? "Enter Password" : null,
|
|
43
|
+
),
|
|
44
|
+
SizedBox(height: 15),
|
|
45
|
+
ElevatedButton(
|
|
46
|
+
onPressed: () {
|
|
47
|
+
if (formKey.currentState!.validate()) {
|
|
48
|
+
print("Login Successful");
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
child: Text("LOGIN"),
|
|
52
|
+
),
|
|
53
|
+
],
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
"""
|
daddy/menu.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(MaterialApp(
|
|
6
|
+
home: MyApp(),
|
|
7
|
+
debugShowCheckedModeBanner: false,
|
|
8
|
+
));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class MyApp extends StatefulWidget {
|
|
12
|
+
const MyApp({super.key});
|
|
13
|
+
|
|
14
|
+
@override
|
|
15
|
+
State<MyApp> createState() => _MyAppState();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class _MyAppState extends State<MyApp> {
|
|
19
|
+
String selected = "Nothing selected";
|
|
20
|
+
|
|
21
|
+
@override
|
|
22
|
+
Widget build(BuildContext context) {
|
|
23
|
+
return Scaffold(
|
|
24
|
+
appBar: AppBar(
|
|
25
|
+
title: Text("Menu Example : Mohd.Shahid Ansari 123"),
|
|
26
|
+
actions: [
|
|
27
|
+
PopupMenuButton(
|
|
28
|
+
onSelected: (value) {
|
|
29
|
+
setState(() {
|
|
30
|
+
selected = value;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
itemBuilder: (context) => [
|
|
34
|
+
PopupMenuItem(value: "Home", child: Text("Home")),
|
|
35
|
+
PopupMenuItem(value: "About", child: Text("About")),
|
|
36
|
+
PopupMenuItem(value: "Exit", child: Text("Exit")),
|
|
37
|
+
],
|
|
38
|
+
),
|
|
39
|
+
],
|
|
40
|
+
),
|
|
41
|
+
body: Center(
|
|
42
|
+
child: Text(
|
|
43
|
+
"Selected: $selected",
|
|
44
|
+
style: TextStyle(fontSize: 24),
|
|
45
|
+
),
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
"""
|
daddy/parent_child.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
// Main function - starting point of the Flutter application
|
|
5
|
+
void main() {
|
|
6
|
+
runApp(MaterialApp(
|
|
7
|
+
debugShowCheckedModeBanner: false,
|
|
8
|
+
home: ParentScreen(),
|
|
9
|
+
));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Parent Widget (Stateful because it changes the counter value)
|
|
13
|
+
class ParentScreen extends StatefulWidget {
|
|
14
|
+
@override
|
|
15
|
+
State<ParentScreen> createState() => _ParentScreenState();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class _ParentScreenState extends State<ParentScreen> {
|
|
19
|
+
// Variable to store the counter value
|
|
20
|
+
int count = 0;
|
|
21
|
+
|
|
22
|
+
// Function to increase the counter
|
|
23
|
+
void increase() {
|
|
24
|
+
setState(() {
|
|
25
|
+
count++;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@override
|
|
30
|
+
Widget build(BuildContext context) {
|
|
31
|
+
return Scaffold(
|
|
32
|
+
appBar: AppBar(
|
|
33
|
+
title: Text("Parent Child Example : hamdan ansari 6009 "),
|
|
34
|
+
),
|
|
35
|
+
body: Center(
|
|
36
|
+
// Passing data and function to Child Widget
|
|
37
|
+
child: ChildScreen(
|
|
38
|
+
number: count,
|
|
39
|
+
onPressed: increase,
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Child Widget (Stateless because it only displays data)
|
|
47
|
+
class ChildScreen extends StatelessWidget {
|
|
48
|
+
final int number;
|
|
49
|
+
final VoidCallback onPressed;
|
|
50
|
+
|
|
51
|
+
ChildScreen({
|
|
52
|
+
required this.number,
|
|
53
|
+
required this.onPressed,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
@override
|
|
57
|
+
Widget build(BuildContext context) {
|
|
58
|
+
return Column(
|
|
59
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
60
|
+
children: [
|
|
61
|
+
Text(
|
|
62
|
+
"Count = $number",
|
|
63
|
+
style: TextStyle(fontSize: 25),
|
|
64
|
+
),
|
|
65
|
+
SizedBox(height: 20),
|
|
66
|
+
ElevatedButton(
|
|
67
|
+
onPressed: onPressed,
|
|
68
|
+
child: Text("Increase"),
|
|
69
|
+
),
|
|
70
|
+
],
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
"""
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
CODE = r"""
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
runApp(const MyApp());
|
|
6
|
+
}
|
|
7
|
+
class MyApp extends StatelessWidget {
|
|
8
|
+
const MyApp({super.key});
|
|
9
|
+
@override
|
|
10
|
+
Widget build(BuildContext context) {
|
|
11
|
+
return const MaterialApp(
|
|
12
|
+
debugShowCheckedModeBanner: false,
|
|
13
|
+
home: HomeScreen(),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class HomeScreen extends StatefulWidget {
|
|
18
|
+
const HomeScreen({super.key});
|
|
19
|
+
@override
|
|
20
|
+
State<HomeScreen> createState() {
|
|
21
|
+
debugPrint("createState() Called");
|
|
22
|
+
return _HomeScreenState();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class _HomeScreenState extends State<HomeScreen> {
|
|
26
|
+
int count = 0;
|
|
27
|
+
@override
|
|
28
|
+
void initState() {
|
|
29
|
+
super.initState();
|
|
30
|
+
debugPrint("initState() Called");
|
|
31
|
+
}
|
|
32
|
+
@override
|
|
33
|
+
void didChangeDependencies() {
|
|
34
|
+
super.didChangeDependencies();
|
|
35
|
+
debugPrint("didChangeDependencies() Called");
|
|
36
|
+
}
|
|
37
|
+
@override
|
|
38
|
+
Widget build(BuildContext context) {
|
|
39
|
+
debugPrint("build() Called");
|
|
40
|
+
return Scaffold(
|
|
41
|
+
appBar: AppBar(
|
|
42
|
+
title: const Text(
|
|
43
|
+
"Hamdan ansari 6009 : StatefulWidget Lifecycle",
|
|
44
|
+
),
|
|
45
|
+
),
|
|
46
|
+
body: Center(
|
|
47
|
+
child: Column(
|
|
48
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
49
|
+
children: [
|
|
50
|
+
Text(
|
|
51
|
+
"Counter = $count",
|
|
52
|
+
style: const TextStyle(fontSize: 30),
|
|
53
|
+
),
|
|
54
|
+
const SizedBox(height: 20),
|
|
55
|
+
ElevatedButton(
|
|
56
|
+
onPressed: () {
|
|
57
|
+
setState(() {
|
|
58
|
+
count++;
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
child: const Text("Increment"),
|
|
62
|
+
),
|
|
63
|
+
],
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
@override
|
|
69
|
+
void deactivate() {
|
|
70
|
+
debugPrint("deactivate() Called");
|
|
71
|
+
super.deactivate();
|
|
72
|
+
}
|
|
73
|
+
@override
|
|
74
|
+
void dispose() {
|
|
75
|
+
debugPrint("dispose() Called");
|
|
76
|
+
super.dispose();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
"""
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: daddy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Flutter Mobile Programming Practicals
|
|
5
|
+
Home-page: https://github.com/hamdan271206-eng/daddy
|
|
6
|
+
Author: Hamdan
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: home-page
|
|
13
|
+
Dynamic: requires-python
|
|
14
|
+
Dynamic: summary
|
|
15
|
+
|
|
16
|
+
# daddy
|
|
17
|
+
|
|
18
|
+
Flutter Mobile Programming Practicals.
|
|
19
|
+
|
|
20
|
+
A Python package containing Dart source code for 11 Flutter practicals.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
pip install daddy
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
from daddy import show
|
|
29
|
+
|
|
30
|
+
show("hello_world")
|
|
31
|
+
|
|
32
|
+
show("menu")
|
|
33
|
+
|
|
34
|
+
show("gridview")
|
|
35
|
+
|
|
36
|
+
## Available practicals
|
|
37
|
+
|
|
38
|
+
from daddy import PRACTICALS
|
|
39
|
+
|
|
40
|
+
print(PRACTICALS)
|
|
41
|
+
|
|
42
|
+
## GitHub
|
|
43
|
+
|
|
44
|
+
https://github.com/hamdan271206-eng/daddy
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
daddy/__init__.py,sha256=GIJYLpkXr-XjEn-_t0-qTF0zL_0AmO3QYKv4tM2viSk,627
|
|
2
|
+
daddy/audio_video.py,sha256=In9LLqcLqv_tVIYTdRTWDKKCbnyvcJ2O2xQE0vuB4Eo,3397
|
|
3
|
+
daddy/custom_listview.py,sha256=TmZRjdxfxOd-OtouBaK1_dFTjzq7k-kK8OdV94Da5lE,979
|
|
4
|
+
daddy/dropdown_listview.py,sha256=n2eNOKU3LuCYBDl4TfCbtezMyJC67XlWhPZ3jchkZVA,1327
|
|
5
|
+
daddy/event_handling.py,sha256=6acdKi8Giv76PPy-WS_kH70WTkP6MYqMNYxOua3yheY,2951
|
|
6
|
+
daddy/expanded_flexible.py,sha256=6ZJ2JNekgg6TqxXgqMHAxY-BymMCvhENPoXg7MLm0sk,1898
|
|
7
|
+
daddy/gridview.py,sha256=3aCrzmn1BkNBJ3Ig_xKuLIyp-X3Z7EHJZZo8yShr9S0,1230
|
|
8
|
+
daddy/hello_world.py,sha256=vB8M5pAssb_1CaXIPJRYzYBDSOWbBPBbM94BbM7V3zk,684
|
|
9
|
+
daddy/login_registration.py,sha256=QFk16HOr4k_Y2lwvhR9gqEj_VwfwBZjcXebIANj8Dik,1587
|
|
10
|
+
daddy/menu.py,sha256=IEcm92eEypMohlMq9DOypq7SNZxl_BS5QEAnzOHG_e4,1139
|
|
11
|
+
daddy/parent_child.py,sha256=KzvgfLrNz2CGTzJ52yHnCCdNGnmWbncFLMkcIqLQSBU,1618
|
|
12
|
+
daddy/stateful_lifecycle.py,sha256=T_z-A1UTov7-7upBKjNjyL3Dpdr5tiOtfsfn35Oh_zM,1794
|
|
13
|
+
daddy-1.0.0.dist-info/METADATA,sha256=3JuwGkBAb6gqVdZxQ7vdunAOa2qgCP6ogfzKusWN_dw,779
|
|
14
|
+
daddy-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
15
|
+
daddy-1.0.0.dist-info/top_level.txt,sha256=veUK2eY4tz4KjLWLKMWPgOxXatTmElR1XNmXNZmWOu0,6
|
|
16
|
+
daddy-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
daddy
|