Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RP IT18229462
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rajasingam kokilan
RP IT18229462
Commits
df26a400
Commit
df26a400
authored
Apr 29, 2022
by
Rajasingam kokilan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main
parent
58900705
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
main.dart
main.dart
+84
-0
No files found.
main.dart
0 → 100644
View file @
df26a400
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
void
main
(
)
{
runApp
(
MyApp
());
}
class
MyApp
extends
StatelessWidget
{
// This widget is the root of your application.
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'tank water level analysier from raspery pi'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
visualDensity:
VisualDensity
.
adaptivePlatformDensity
,
),
home:
MyHomePage
(
title:
'Tank water level from raspery pi'
),
);
}
}
class
MyHomePage
extends
StatefulWidget
{
MyHomePage
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
@override
_MyHomePageState
createState
()
=>
_MyHomePageState
();
}
class
_MyHomePageState
extends
State
<
MyHomePage
>
{
static
const
platform
=
const
MethodChannel
(
'samples.flutter.dev/connect wit rasperypi'
);
String
_tankLevel
=
'you can find water level heair.'
;
Future
<
void
>
_gettankLevel
()
async
{
String
tankLevel
;
try
{
final
int
result
=
await
platform
.
invokeMethod
(
'gettankLevel'
);
tankLevel
=
'tank level at
$result
% .'
;
}
on
PlatformException
catch
(
e
)
{
tankLevel
=
"Failed to get tank level: '
${e.message}
'."
;
}
setState
(()
{
_tankLevel
=
_tankLevel
;
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
widget
.
title
),
),
body:
Center
(
child:
Column
(
// horizontal).
mainAxisAlignment:
MainAxisAlignment
.
center
,
//padding: new EdgeInsets.all(20),
children:
<
Widget
>[
Text
(
_tankLevel
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
20.0
),
),
],
),
),
floatingActionButton:
Padding
(
child:
FloatingActionButton
.
extended
(
elevation:
4.0
,
//icon: const Icon(Icons.add),
label:
const
Text
(
'Get tank level'
),
onPressed:
_gettankLevel
,
),
padding:
new
EdgeInsets
.
only
(
bottom:
20
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerDocked
,
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment