Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qorri_di
medapp_eksad
Commits
71e7fdd5
Commit
71e7fdd5
authored
Sep 28, 2022
by
Ade Fikriatul Ilmi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add site title and scroll up
parent
51332105
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
521 additions
and
131 deletions
+521
-131
setting_api.dart
lib/api/setting_api.dart
+6
-0
homepage.dart
lib/homepage.dart
+94
-16
main.dart
lib/main.dart
+1
-1
about_us.dart
lib/screen/about_us.dart
+99
-20
footer.dart
lib/screen/footer.dart
+157
-67
home1.dart
lib/screen/home/home1.dart
+2
-1
small_home1.dart
lib/screen_small/small_home/small_home1.dart
+4
-4
home_user.dart
lib/screen_user/home_user.dart
+100
-22
Scroll_top.dart
lib/widget/Scroll_top.dart
+58
-0
No files found.
lib/api/setting_api.dart
View file @
71e7fdd5
...
...
@@ -61,3 +61,9 @@ Future<List<dynamic>> getSettingDesc() async {
Uri
.
parse
(
'
$qry
/setting/getSettingByIdDesc'
));
return
jsonDecode
(
response
.
body
)[
'data'
];
}
Future
<
dynamic
>
getSettingDesc2
()
async
{
var
response
=
await
http
.
get
(
Uri
.
parse
(
'
$qry
/setting/getSettingByIdDesc'
));
return
jsonDecode
(
response
.
body
)[
'data'
];
}
\ No newline at end of file
lib/homepage.dart
View file @
71e7fdd5
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:medapp_eksad/api/setting_api.dart'
;
import
'package:medapp_eksad/appbar/appbar_home.dart'
;
import
'package:medapp_eksad/screen_small/small_contact/small_contact_us2.dart'
;
import
'package:medapp_eksad/screen/contact_us/contact_us2.dart'
;
...
...
@@ -12,6 +14,7 @@ import 'package:medapp_eksad/screen_small/small_home/small_home1.dart';
import
'package:medapp_eksad/screen_small/small_home/small_home2.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home3.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home4.dart'
;
import
'package:medapp_eksad/widget/Scroll_top.dart'
;
import
'package:medapp_eksad/widget/drawer.dart'
;
import
'package:medapp_eksad/widget/responsive.dart'
;
import
'package:medapp_eksad/widget/whatsapp.dart'
;
...
...
@@ -32,10 +35,26 @@ class HomePage extends StatefulWidget {
}
class
_HomePageState
extends
State
<
HomePage
>
{
// Untuk pake PAGE per index
PageController
controller
=
PageController
();
void
_scrollToIndex2
(
int
index
)
{
controller
.
animateToPage
(
index
,
duration:
const
Duration
(
seconds:
2
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
// Untuk pake LIST per height container
ScrollController
controller2
=
ScrollController
();
void
_scrollToIndex
(
double
index
)
{
controller2
.
animateTo
(
index
,
duration:
const
Duration
(
seconds:
1
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
@override
Widget
build
(
BuildContext
context
)
{
setPageTitle
(
'MedApp by Eksad'
,
context
);
//
setPageTitle('MedApp by Eksad', context);
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
key:
_scaffoldKey
,
...
...
@@ -46,26 +65,85 @@ class _HomePageState extends State<HomePage> {
Colors
.
black
,
Colors
.
black
,
Colors
.
black
),
drawer:
const
DrawerMedApp
(),
body:
ResponsiveWidget
.
isSmallScreen
(
context
)
?
ListView
(
children:
const
[
SmallHome1
(),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
?
Stack
(
children:
[
Title
(
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
SmallHome1
(
wijet:
Button_scroll_small
()),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
],
),
),
ScrollUpButton
(
controller2
),
],
)
:
ListView
(
:
Stack
(
children:
[
const
Home1
(),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
FutureBuilder
<
dynamic
>(
future:
getSettingDesc2
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
return
Title
(
title:
pgm
[
'title'
],
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
Home1
(
wijet:
Button_scroll
()),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
],
),
);
},
),
ScrollUpButton
(
controller2
),
],
),
);
}
ElevatedButton
Button_scroll
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
3780
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
17
,
letterSpacing:
2
,
fontWeight:
FontWeight
.
w500
),
),
);
}
ElevatedButton
Button_scroll_small
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
5410
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
fixedSize:
const
Size
(
50
,
20
)),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
15
,
letterSpacing:
1.5
,
fontWeight:
FontWeight
.
w500
),
),
);
}
...
...
lib/main.dart
View file @
71e7fdd5
...
...
@@ -40,7 +40,7 @@ class MyApp extends StatelessWidget {
],
child:
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
"MedApp by Eksad"
,
//
title: "MedApp by Eksad",
initialRoute:
'/'
,
routes:
{
'/'
:
(
context
)
=>
const
HomePage
(),
...
...
lib/screen/about_us.dart
View file @
71e7fdd5
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:medapp_eksad/api/setting_api.dart'
;
import
'package:medapp_eksad/appbar/appbar_home.dart'
;
import
'package:medapp_eksad/screen_small/small_contact/small_contact_us2.dart'
;
import
'package:medapp_eksad/screen/contact_us/contact_us2.dart'
;
...
...
@@ -12,6 +14,7 @@ import 'package:medapp_eksad/screen_small/small_home/small_home1.dart';
import
'package:medapp_eksad/screen_small/small_home/small_home2.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home3.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home4.dart'
;
import
'package:medapp_eksad/widget/Scroll_top.dart'
;
import
'package:medapp_eksad/widget/drawer.dart'
;
import
'package:medapp_eksad/widget/responsive.dart'
;
import
'package:medapp_eksad/widget/whatsapp.dart'
;
...
...
@@ -32,10 +35,26 @@ class AboutUs extends StatefulWidget {
}
class
_AboutUsState
extends
State
<
AboutUs
>
{
// Untuk pake PAGE per index
PageController
controller
=
PageController
();
void
_scrollToIndex2
(
int
index
)
{
controller
.
animateToPage
(
index
,
duration:
const
Duration
(
seconds:
2
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
// Untuk pake LIST per height container
ScrollController
controller2
=
ScrollController
();
void
_scrollToIndex
(
double
index
)
{
controller2
.
animateTo
(
index
,
duration:
const
Duration
(
seconds:
1
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
@override
Widget
build
(
BuildContext
context
)
{
setPageTitle
(
'About Us'
,
context
);
//
setPageTitle('About Us', context);
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
key:
_scaffoldKey
,
...
...
@@ -45,26 +64,86 @@ class _AboutUsState extends State<AboutUs> {
:
AppbarHomeLarge
(
screenSize
,
context
,
Colors
.
black
,
Colors
.
blue
,
Colors
.
black
,
Colors
.
black
,
Colors
.
black
),
drawer:
const
DrawerMedApp
(),
body:
ResponsiveWidget
.
isSmallScreen
(
context
)
?
ListView
(
children:
const
[
SmallHome1
(),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
],
)
:
ListView
(
children:
[
const
Home1
(),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
],
?
Stack
(
children:
[
Title
(
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
SmallHome1
(
wijet:
Button_scroll_small
()),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
],
),
),
ScrollUpButton
(
controller2
),
],
)
:
Stack
(
children:
[
FutureBuilder
<
dynamic
>(
future:
getSettingDesc2
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
return
Title
(
title:
pgm
[
'title'
],
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
Home1
(
wijet:
Button_scroll
()),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
],
),
);
},
),
ScrollUpButton
(
controller2
),
],
),
);
}
ElevatedButton
Button_scroll
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
3780
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
17
,
letterSpacing:
2
,
fontWeight:
FontWeight
.
w500
),
),
);
}
ElevatedButton
Button_scroll_small
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
5410
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
fixedSize:
const
Size
(
50
,
20
)),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
15
,
letterSpacing:
1.5
,
fontWeight:
FontWeight
.
w500
),
),
);
}
...
...
lib/screen/footer.dart
View file @
71e7fdd5
...
...
@@ -87,78 +87,21 @@ class Footer extends StatelessWidget {
),
),
const
Spacer
(
flex:
1
,
flex:
2
,
),
Container
(
width:
screenSize
.
width
*
0.1
4
,
width:
screenSize
.
width
*
0.1
6
,
height:
screenSize
.
height
*
0.03
,
//color: Colors.blue,
child:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
IconButton
(
onPressed:
()
{
ln
=
pgm
[
'linkedin'
];
launch
(
ln
);
// _launchLinkedIn();
},
icon:
const
Icon
(
FontAwesomeIcons
.
linkedinIn
,
size:
25
,
),
iconSize:
25
,
color:
Colors
.
black
),
IconButton
(
onPressed:
()
{
tw
=
pgm
[
'twitter'
];
launch
(
tw
);
//_launchTwitter();
},
icon:
const
Icon
(
FontAwesomeIcons
.
twitter
,
size:
25
,
),
iconSize:
25
,
color:
Colors
.
black
,
),
IconButton
(
onPressed:
()
{
ig
=
pgm
[
'instagram'
];
launch
(
ig
);
// _launchInstagram();
},
icon:
const
Icon
(
FontAwesomeIcons
.
instagram
,
size:
25
,
),
iconSize:
25
,
color:
Colors
.
black
),
IconButton
(
onPressed:
()
{
yt
=
pgm
[
'youtube'
];
launch
(
yt
);
// _launchYoutube();
},
icon:
const
Icon
(
FontAwesomeIcons
.
youtube
,
size:
25
,
),
iconSize:
25
,
color:
Colors
.
black
)
],
);
},
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
const
[
ApiLinkedin
(),
ApiTwitter
(),
ApiInstagram
(),
ApiYoutube
()
],
),
),
const
Spacer
(
flex:
8
,
...
...
@@ -366,6 +309,153 @@ class itemBawah extends StatelessWidget {
}
}
class
ApiLinkedin
extends
StatefulWidget
{
const
ApiLinkedin
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
ApiLinkedin
>
createState
()
=>
_ApiLinkedinState
();
}
class
_ApiLinkedinState
extends
State
<
ApiLinkedin
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
FutureBuilder
<
List
<
dynamic
>>(
future:
getLnDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
IconButton
(
onPressed:
()
{
// ln = ;
launch
(
pgm
[
'linkedin'
]);
// _launchLinkedIn();
},
icon:
const
Icon
(
FontAwesomeIcons
.
linkedinIn
,
size:
25
,
),
iconSize:
35
,
color:
Colors
.
black
);
},
);
}
}
class
ApiTwitter
extends
StatefulWidget
{
const
ApiTwitter
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
ApiTwitter
>
createState
()
=>
_ApiTwitterState
();
}
class
_ApiTwitterState
extends
State
<
ApiTwitter
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
FutureBuilder
<
List
<
dynamic
>>(
future:
getTwDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
IconButton
(
onPressed:
()
{
// ln = ;
launch
(
pgm
[
'twitter'
]);
// _launchLinkedIn();
},
icon:
const
Icon
(
FontAwesomeIcons
.
twitter
,
size:
25
,
),
iconSize:
35
,
color:
Colors
.
black
);
},
);
}
}
class
ApiInstagram
extends
StatefulWidget
{
const
ApiInstagram
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
ApiInstagram
>
createState
()
=>
_ApiInstagramState
();
}
class
_ApiInstagramState
extends
State
<
ApiInstagram
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
FutureBuilder
<
List
<
dynamic
>>(
future:
getIgDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
IconButton
(
onPressed:
()
{
// ln = ;
launch
(
pgm
[
'instagram'
]);
// _launchLinkedIn();
},
icon:
const
Icon
(
FontAwesomeIcons
.
instagram
,
size:
25
,
),
iconSize:
35
,
color:
Colors
.
black
);
},
);
}
}
class
ApiYoutube
extends
StatefulWidget
{
const
ApiYoutube
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
ApiYoutube
>
createState
()
=>
_ApiYoutubeState
();
}
class
_ApiYoutubeState
extends
State
<
ApiYoutube
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
FutureBuilder
<
List
<
dynamic
>>(
future:
getYtDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
IconButton
(
onPressed:
()
{
// ln = ;
launch
(
pgm
[
'youtube'
]);
// _launchLinkedIn();
},
icon:
const
Icon
(
FontAwesomeIcons
.
youtube
,
size:
25
,
),
iconSize:
35
,
color:
Colors
.
black
);
});
}
}
class
TelphoneApi
extends
StatefulWidget
{
const
TelphoneApi
({
Key
?
key
})
:
super
(
key:
key
);
...
...
lib/screen/home/home1.dart
View file @
71e7fdd5
...
...
@@ -6,7 +6,8 @@ import 'package:medapp_eksad/widget/button_color.dart';
import
'package:show_up_animation/show_up_animation.dart'
;
class
Home1
extends
StatelessWidget
{
const
Home1
({
Key
?
key
})
:
super
(
key:
key
);
Home1
({
Key
?
key
,
required
this
.
wijet
})
:
super
(
key:
key
);
final
Widget
wijet
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
lib/screen_small/small_home/small_home1.dart
View file @
71e7fdd5
...
...
@@ -3,9 +3,9 @@ import 'package:google_fonts/google_fonts.dart';
import
'package:medapp_eksad/widget/button_color.dart'
;
import
'package:show_up_animation/show_up_animation.dart'
;
class
SmallHome1
extends
StatelessWidget
{
const
SmallHome1
({
Key
?
key
})
:
super
(
key:
key
);
SmallHome1
({
Key
?
key
,
required
this
.
wijet
})
:
super
(
key:
key
);
final
Widget
wijet
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -75,8 +75,8 @@ class SmallHome1 extends StatelessWidget {
// offset: -0.2,
child:
Text
(
'Welcome to healthcare’s most powerful collaboration suite. '
'Enhance clinical workflows, speed decisions, and improve'
' patient outcomes, safely and securely.'
,
'Enhance clinical workflows, speed decisions, and improve'
' patient outcomes, safely and securely.'
,
textAlign:
TextAlign
.
center
,
style:
GoogleFonts
.
poppins
(
fontSize:
15
,
...
...
lib/screen_user/home_user.dart
View file @
71e7fdd5
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:medapp_eksad/api/setting_api.dart'
;
import
'package:medapp_eksad/appbar/appbar_home.dart'
;
import
'package:medapp_eksad/screen_small/small_contact/small_contact_us2.dart'
;
import
'package:medapp_eksad/screen/contact_us/contact_us2.dart'
;
...
...
@@ -12,6 +14,7 @@ import 'package:medapp_eksad/screen_small/small_home/small_home1.dart';
import
'package:medapp_eksad/screen_small/small_home/small_home2.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home3.dart'
;
import
'package:medapp_eksad/screen_small/small_home/small_home4.dart'
;
import
'package:medapp_eksad/widget/Scroll_top.dart'
;
import
'package:medapp_eksad/widget/drawer.dart'
;
import
'package:medapp_eksad/widget/responsive.dart'
;
import
'package:medapp_eksad/widget/whatsapp.dart'
;
...
...
@@ -32,10 +35,26 @@ class HomePageUser extends StatefulWidget {
}
class
_HomePageUserState
extends
State
<
HomePageUser
>
{
// Untuk pake PAGE per index
PageController
controller
=
PageController
();
void
_scrollToIndex2
(
int
index
)
{
controller
.
animateToPage
(
index
,
duration:
const
Duration
(
seconds:
2
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
// Untuk pake LIST per height container
ScrollController
controller2
=
ScrollController
();
void
_scrollToIndex
(
double
index
)
{
controller2
.
animateTo
(
index
,
duration:
const
Duration
(
seconds:
1
),
curve:
Curves
.
fastLinearToSlowEaseIn
);
}
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
@override
Widget
build
(
BuildContext
context
)
{
setPageTitle
(
'MedApp by Eksad'
,
context
);
//
setPageTitle('MedApp by Eksad', context);
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
key:
_scaffoldKey
,
...
...
@@ -43,28 +62,87 @@ class _HomePageUserState extends State<HomePageUser> {
appBar:
ResponsiveWidget
.
isSmallScreen
(
context
)
?
AppBarKecil
()
:
AppbarHomeLarge
(
screenSize
,
context
,
Colors
.
blue
,
Colors
.
black
,
Colors
.
black
,
Colors
.
black
,
Colors
.
black
),
Colors
.
black
,
Colors
.
black
,
Colors
.
black
),
drawer:
const
DrawerMedApp
(),
body:
ResponsiveWidget
.
isSmallScreen
(
context
)
?
ListView
(
children:
const
[
SmallHome1
(),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
],
)
:
ListView
(
children:
[
const
Home1
(),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
],
body:
ResponsiveWidget
.
isSmallScreen
(
context
)
?
Stack
(
children:
[
Title
(
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
SmallHome1
(
wijet:
Button_scroll_small
()),
SmallHome2
(),
SmallHome3
(),
SmallHome4
(),
ContactUs2_small
(),
FooterSmall
(),
],
),
),
ScrollUpButton
(
controller2
),
],
)
:
Stack
(
children:
[
FutureBuilder
<
dynamic
>(
future:
getSettingDesc2
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
return
Title
(
title:
pgm
[
'title'
],
color:
Colors
.
white
,
child:
ListView
(
scrollDirection:
Axis
.
vertical
,
controller:
controller2
,
children:
[
Home1
(
wijet:
Button_scroll
()),
const
Home2
(),
const
Home3
(),
const
Home4
(),
ContactUs2
(),
Footer
(),
],
),
);
},
),
ScrollUpButton
(
controller2
),
],
),
);
}
ElevatedButton
Button_scroll
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
3780
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
17
,
letterSpacing:
2
,
fontWeight:
FontWeight
.
w500
),
),
);
}
ElevatedButton
Button_scroll_small
()
{
return
ElevatedButton
(
onPressed:
()
{
_scrollToIndex
(
5410
);
},
style:
ElevatedButton
.
styleFrom
(
primary:
const
Color
(
0xff1e5ea8
),
fixedSize:
const
Size
(
50
,
20
)),
child:
Text
(
'CONTACT US'
,
style:
GoogleFonts
.
poppins
(
fontSize:
15
,
letterSpacing:
1.5
,
fontWeight:
FontWeight
.
w500
),
),
);
}
...
...
lib/widget/Scroll_top.dart
0 → 100644
View file @
71e7fdd5
import
'package:flutter/material.dart'
;
class
ScrollUpButton
extends
StatefulWidget
{
const
ScrollUpButton
(
this
.
controller
);
final
ScrollController
controller
;
@override
_ScrollUpButtonState
createState
()
=>
_ScrollUpButtonState
();
}
class
_ScrollUpButtonState
extends
State
<
ScrollUpButton
>
{
bool
_showScrollUp
=
false
;
@override
void
initState
()
{
super
.
initState
();
widget
.
controller
.
addListener
(()
{
if
(
widget
.
controller
.
position
.
pixels
>
150
&&
!
_showScrollUp
)
{
setState
(()
{
_showScrollUp
=
true
;
});
}
else
if
(
widget
.
controller
.
position
.
pixels
<
150
&&
_showScrollUp
)
{
setState
(()
{
_showScrollUp
=
false
;
});
}
// On GitHub there was a question on how to determine the event
// of widget being scrolled to the bottom. Here's the sample
// if (widget.controller.position.hasViewportDimension &&
// widget.controller.position.pixels >=
// widget.controller.position.maxScrollExtent - 0.01) {
// print('Scrolled to bottom');
//}
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
_showScrollUp
?
Positioned
(
right:
20
,
bottom:
170
,
child:
OutlinedButton
(
onPressed:
()
=>
widget
.
controller
.
animateTo
(
0
,
duration:
const
Duration
(
milliseconds:
300
),
curve:
Curves
.
easeIn
),
style:
ButtonStyle
(
fixedSize:
MaterialStateProperty
.
all
(
Size
(
30
,
30
)),
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
grey
[
50
]),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
black
)),
child:
Icon
(
Icons
.
arrow_circle_up
,
color:
Colors
.
grey
,)
//child: const Text('Go\nTop',textAlign: TextAlign.center,),
))
:
const
SizedBox
();
}
}
\ No newline at end of file
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