This repository was archived by the owner on Nov 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathhello.dart
More file actions
88 lines (85 loc) · 3.35 KB
/
Copy pathhello.dart
File metadata and controls
88 lines (85 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import 'package:flutter/material.dart';
import 'package:hello_world/contract_linking.dart';
import 'package:provider/provider.dart';
class Hello extends StatelessWidget {
const Hello({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// Getting the value and object or contract_linking
final contractLink = Provider.of<ContractLinking>(context);
final yourNameController = TextEditingController();
return Scaffold(
appBar: AppBar(
title: const Text('Hello World !'),
centerTitle: true,
),
body: Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Center(
child: contractLink.isLoading
? const CircularProgressIndicator()
: SingleChildScrollView(
child: Form(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Flexible(
child: Text(
'Hello ',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 32,
),
),
),
Flexible(
child: Text(
contractLink.deployedName,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 32,
color: Colors.tealAccent,
),
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 29),
child: TextFormField(
controller: yourNameController,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Your Name',
hintText: 'What is your name ?',
icon: Icon(Icons.drive_file_rename_outline),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 30),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green,
),
onPressed: () {
contractLink.setName(yourNameController.text);
yourNameController.clear();
},
child: const Text(
'Set Name',
style: TextStyle(fontSize: 30),
),
),
)
],
),
),
),
),
),
);
}
}