diff --git a/README.md b/README.md index 23a57af5..7ca20299 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ The code for Springy Widget is taken and refactored from (https://github.com/mat ## miscellaneous widgets - + ## Blog diff --git a/lib/core/presentation/routes.dart b/lib/core/presentation/routes.dart index ec2cf8d7..5b42b4e9 100644 --- a/lib/core/presentation/routes.dart +++ b/lib/core/presentation/routes.dart @@ -13,6 +13,7 @@ import 'package:flutter_ui_challenges/src/pages/invitation/invitation1.dart'; import 'package:flutter_ui_challenges/src/pages/login/auth3.dart'; import 'package:flutter_ui_challenges/src/pages/misc/bottomsheet.dart'; import 'package:flutter_ui_challenges/src/pages/food/cake.dart'; +import 'package:flutter_ui_challenges/src/pages/misc/gallery1.dart'; import 'package:flutter_ui_challenges/src/pages/misc/image_popup.dart'; import 'package:flutter_ui_challenges/src/pages/misc/musicplayer.dart'; import 'package:flutter_ui_challenges/src/pages/misc/musicplayer2.dart'; @@ -275,7 +276,8 @@ final List pages = [ SubMenuItem("Onboarding 5", Intro5(), path: Intro5.path), ]), MenuItem(title: "Miscellaneous", items: [ - + SubMenuItem("Gallery One", GalleryPageOne(), + path: GalleryPageOne.path), SubMenuItem("Music Player Two", MusicPlayerTwoPage(), path: MusicPlayerTwoPage.path), SubMenuItem("Image Popup", ImagePopupPage(), diff --git a/lib/src/pages/misc/gallery1.dart b/lib/src/pages/misc/gallery1.dart new file mode 100644 index 00000000..815990e1 --- /dev/null +++ b/lib/src/pages/misc/gallery1.dart @@ -0,0 +1,66 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; +import 'package:flutter_ui_challenges/src/pages/animations/animation1/animation1.dart'; + +class GalleryPageOne extends StatelessWidget { + static final String path = "lib/src/pages/misc/gallery1.dart"; + final List _staggeredTiles = const [ + const StaggeredTile.count(2, 2), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(2, 2), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(1, 1), + const StaggeredTile.count(2, 1), + const StaggeredTile.count(1, 2), + const StaggeredTile.count(1, 1), + ]; + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + centerTitle: true, + elevation: 0, + title: Text( + 'Photos', + style: TextStyle(color: Colors.black), + ), + backgroundColor: Colors.transparent, + iconTheme: IconThemeData(color: Colors.black), + actions: [ + FlatButton( + textColor: Colors.blue, + child: Text("Add New"), + onPressed: () {}, + ) + ], + ), + body: StaggeredGridView.countBuilder( + padding: const EdgeInsets.all(8.0), + crossAxisCount: 3, + itemCount: 16, + itemBuilder: (context, index) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: + CachedNetworkImageProvider(images[index % images.length]), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(10.0)), + ), + staggeredTileBuilder: (index) => _staggeredTiles[index], + mainAxisSpacing: 8.0, + crossAxisSpacing: 8.0, + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 11f524f8..dec7b89f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,7 @@ dependencies: firebase_remote_config: ^0.3.0+1 firebase_core: ^0.4.3+1 firebase_analytics: ^5.0.9 + flutter_staggered_grid_view: ^0.3.0 dev_dependencies: flutter_test: sdk: flutter diff --git a/screenshots/gallery1.png b/screenshots/gallery1.png new file mode 100644 index 00000000..72f8b965 Binary files /dev/null and b/screenshots/gallery1.png differ