WoofnWalk / lib / widgets / walker_widget.dart
walker_widget.dart
Raw
import 'package:flutter/material.dart';
import '../screens/maps/walkers_detail_screen.dart';
import './location_input.dart';
import '../model/walker.dart';

class WalkerListWidget extends StatelessWidget {
  final Walker walker;

  WalkerListWidget({required this.walker});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(left: 1, top: 5, right: 1, bottom: 8),
      child: Card(
          borderOnForeground: true,
          child: InkWell(
            splashColor: Colors.deepPurpleAccent.withAlpha(30),
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (context) => WalkerDetailScreen(walker: walker)),
              );
            },
            child: Column(
              children: <Widget>[
                Column(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Row(children: [
                        walker.imgUrl == ''
                            ? Wrap(
                                children: const [Text('No photo')],
                              )
                            : CircleAvatar(
                                backgroundImage: NetworkImage(walker.imgUrl!),
                              ),
                        Expanded(
                            flex: 8,
                            child: Column(
                              children: [
                                Text(
                                  walker.name,
                                  style: const TextStyle(
                                    fontSize: 20.0,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                                Text('Yrs Experience: ' +
                                    walker.yrsExp.toString()),
                                Text(
                                  "Charge: \$" + walker.price.toString(),
                                  style: const TextStyle(
                                      fontWeight: FontWeight.bold),
                                ),
                              ],
                            )),
                      ]),
                    ),
                    LocationInput(
                        latitude: walker.location.latitude,
                        longitude: walker.location.longitude),
                    const Padding(
                        padding: EdgeInsets.only(
                            top: 8.0, left: 1.0, right: 1.0, bottom: 8.0),
                        child: Text('MORE DETAILS',
                            textAlign: TextAlign.left,
                            style: TextStyle(
                              fontWeight: FontWeight.bold,
                              color: Colors.deepPurpleAccent,
                            ))),
                  ],
                ),
              ],
            ),
          )),
    );
  }
}