Created
September 13, 2021 06:31
-
-
Save red-star25/182a2aba682c2760f5146c403430f67c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MaterialApp(home: MyApp())); | |
class MyApp extends StatefulWidget { | |
@override | |
State<MyApp> createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
bool _visible = true; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: CustomScrollView( | |
slivers: <Widget>[ | |
SliverToBoxAdapter( | |
child: Image.network( | |
"https://1gew6o3qn6vx9kp3s42ge0y1-wpengine.netdna-ssl.com/wp-content/uploads/prod/2020/10/HERO-ART-microsoft_azure_1920x1000_nologo.jpg", | |
width: double.infinity, | |
height: 300, | |
fit: BoxFit.cover, | |
), | |
), | |
SliverIgnorePointer( | |
ignoring: true, | |
ignoringSemantics: true, | |
sliver: SliverPadding( | |
padding: EdgeInsets.only(top: 18), | |
sliver: SliverToBoxAdapter( | |
child: FloatingActionButton( | |
onPressed: () { | |
setState(() { | |
_visible = !_visible; | |
}); | |
}, | |
child: | |
Icon(!_visible ? Icons.visibility : Icons.visibility_off), | |
)), | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment