Preliminary code for the event list tile, layout and title
This commit is contained in:
parent
118bb26713
commit
86742a6746
5 changed files with 92 additions and 21 deletions
13
lib/src/mixins/tile_mixin.dart
Normal file
13
lib/src/mixins/tile_mixin.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
mixin Tile {
|
||||||
|
BoxDecoration tileDecoration(BuildContext context) {
|
||||||
|
return BoxDecoration(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(8),
|
||||||
|
bottomRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'package:flutter/material.dart' hide AppBar;
|
import 'package:flutter/material.dart' hide AppBar;
|
||||||
|
|
||||||
import '../blocs/events_bloc.dart';
|
import '../blocs/events_bloc.dart';
|
||||||
|
import '../models/event_model.dart';
|
||||||
import '../widgets/app_bar.dart';
|
import '../widgets/app_bar.dart';
|
||||||
|
import '../widgets/event_list_tile.dart';
|
||||||
import '../widgets/populated_drawer.dart';
|
import '../widgets/populated_drawer.dart';
|
||||||
|
|
||||||
class EventsScreen extends StatefulWidget {
|
class EventsScreen extends StatefulWidget {
|
||||||
|
|
@ -24,6 +26,7 @@ class _EventsScreenState extends State<EventsScreen> {
|
||||||
userDisplayName = userSnap.data.displayName;
|
userDisplayName = userSnap.data.displayName;
|
||||||
userEmail = userSnap.data.email;
|
userEmail = userSnap.data.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: PopulatedDrawer(
|
drawer: PopulatedDrawer(
|
||||||
userAvatarUrl: userAvatarUrl,
|
userAvatarUrl: userAvatarUrl,
|
||||||
|
|
@ -35,6 +38,23 @@ class _EventsScreenState extends State<EventsScreen> {
|
||||||
title: 'My Events',
|
title: 'My Events',
|
||||||
hasDrawer: true,
|
hasDrawer: true,
|
||||||
),
|
),
|
||||||
|
body: ListView(
|
||||||
|
padding: EdgeInsets.only(top: 15),
|
||||||
|
children: <Widget>[
|
||||||
|
EventListTile(
|
||||||
|
event: EventModel(
|
||||||
|
id: '1',
|
||||||
|
name: 'Math',
|
||||||
|
pendigTasks: 3,
|
||||||
|
media: <String>[],
|
||||||
|
when: <bool>[],
|
||||||
|
highPriority: 2,
|
||||||
|
mediumPriority: 1,
|
||||||
|
lowPriority: 0,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,19 @@ const kSmallTextStyle = TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const kTileBigTextStyle = TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
|
||||||
|
const kTileSubtitleStyle = TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
);
|
||||||
|
|
||||||
const kBlueGradient = LinearGradient(
|
const kBlueGradient = LinearGradient(
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../models/event_model.dart';
|
||||||
|
import '../mixins/tile_mixin.dart';
|
||||||
|
import '../utils.dart';
|
||||||
|
|
||||||
|
class EventListTile extends StatelessWidget with Tile {
|
||||||
|
final EventModel event;
|
||||||
|
|
||||||
|
EventListTile({@required this.event}) : assert(event != null);
|
||||||
|
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FractionallySizedBox(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
widthFactor: .95,
|
||||||
|
child: Container(
|
||||||
|
height: 85,
|
||||||
|
child: Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
event.name,
|
||||||
|
style: kTileBigTextStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
decoration: tileDecoration(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
|
import '../mixins/tile_mixin.dart';
|
||||||
import '../models/task_model.dart';
|
import '../models/task_model.dart';
|
||||||
import '../utils.dart';
|
import '../utils.dart';
|
||||||
import '../widgets/action_button.dart';
|
import '../widgets/action_button.dart';
|
||||||
|
|
||||||
/// A card that visually represents a task.
|
/// A card that visually represents a task.
|
||||||
class TaskListTile extends StatelessWidget {
|
class TaskListTile extends StatelessWidget with Tile {
|
||||||
/// Task model which this card represents.
|
/// Task model which this card represents.
|
||||||
final TaskModel task;
|
final TaskModel task;
|
||||||
|
|
||||||
|
|
@ -79,19 +80,11 @@ class TaskListTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
task.event,
|
task.event,
|
||||||
style: TextStyle(
|
style: kTileBigTextStyle,
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 24,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
task.text,
|
task.text,
|
||||||
style: TextStyle(
|
style: kTileSubtitleStyle,
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: FontWeight.w300,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -169,14 +162,4 @@ class TaskListTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BoxDecoration tileDecoration(BuildContext context) {
|
|
||||||
return BoxDecoration(
|
|
||||||
color: Theme.of(context).cardColor,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: Radius.circular(8),
|
|
||||||
bottomRight: Radius.circular(8),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue