Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:adaTeman/utils/utils.dart';
- import 'package:adaTeman/components/infos/locationInfo.dart';
- import 'package:adaTeman/locations.dart';
- import 'package:adaTeman/postPage/detailKategori.dart';
- import 'package:adaTeman/search.dart';
- class ExploreView extends StatefulWidget {
- var location = "Jalan Haji Saimang";
- @override
- _ExploreViewState createState() => _ExploreViewState();
- }
- class _ExploreViewState extends State<ExploreView> {
- var util = new Util();
- getLocation(BuildContext context) async {
- final result = await Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => MapPage()),
- );
- if (result != null) {
- setState(() {
- widget.location = result;
- });
- }
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- color: util.hexToColor("#FAFAFA"),
- child: new Column(
- children: <Widget>[
- new InkWell(
- child: new LocationInfo(location: widget.location),
- onTap: () {
- getLocation(context);
- },
- ),
- new Padding(
- padding: EdgeInsets.only(top: 10.0)
- ),
- new Divider(
- color: util.hexToColor("#000000"),
- height: 0.0,
- ),
- new Expanded(
- child: GridView.count(
- primary: true,
- childAspectRatio: 1.0,
- crossAxisCount: 2,
- children: <Widget>[
- _makeGridCell("Education"),
- _makeGridCell("Outdoor & Travel"),
- _makeGridCell("Electronics"),
- _makeGridCell("Men's Fashion"),
- _makeGridCell("Sports"),
- _makeGridCell("Women's Fashion"),
- _makeGridCell("Music"),
- _makeGridCell("Cooking"),
- _makeGridCell("Leisure"),
- _makeGridCell("Miscellaneous"),
- ],
- ),
- ),
- ],
- ),
- );
- }
- Widget _makeGridCell(String categoryName) {
- return Container(
- child: new Card(
- elevation: 0.0,
- child: InkWell(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- verticalDirection: VerticalDirection.down,
- children: <Widget>[
- new Center(
- child: new Image(
- image: util.itemCategoryParseToImage(categoryName),
- height: 48.0,
- width: 48.0,
- ),
- ),
- new Padding(
- padding: EdgeInsets.all(6.0),
- ),
- new Center(
- child: Text(categoryName),
- ),
- ],
- ),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => CategoryDetail(category: categoryName)
- )
- );
- }
- ),
- ),
- decoration: BoxDecoration(
- border: new Border.all(color: util.hexToColor("#DDDDDD"))
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement