Skip to content

Commit

Permalink
Add drawer icon for small screen devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrysbita committed Dec 6, 2021
1 parent 30e93de commit e60f35d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
16 changes: 16 additions & 0 deletions lib/main/calendar/calendar_page.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import 'package:extended_image/extended_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../global.dart';
import '../../redux/state/state.dart';
import '../../route.dart';
import '../../util/platform.dart';
import '../../util/screen.dart';
import '../main_page.dart';
import 'assignment.dart';
import 'exam.dart';
Expand Down Expand Up @@ -79,6 +83,18 @@ class _CalendarPageState extends State<CalendarPage>
color: Theme.of(context).colorScheme.surface,
child: Row(
children: [
if (context.isBetween(Breakpoint.extraSmall))
StoreConnector<AppState, String>(
distinct: true,
converter: (s) =>
store.state.user.profile.avatar.isNotEmpty
? store.state.user.profile.avatar
: remoteConfigs.staticResources.defaultAvatar,
builder: (_, s) => IconButton(
onPressed: () => Scaffold.of(context).openDrawer(),
icon: ExtendedImage.network(s, shape: BoxShape.circle),
),
),
Expanded(
child: TabBar(
isScrollable: true,
Expand Down
9 changes: 4 additions & 5 deletions lib/main/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _MainPageState extends State<MainPage> {
CampusPage(),
];

int _index = 0;
var _index = 0;

void navigateTo(int index) {
if (!mounted || index == _index) return;
Expand Down Expand Up @@ -99,11 +99,10 @@ class _MainPageState extends State<MainPage> {
const VerticalDivider(thickness: 1, width: 1),
Expanded(
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 200),
transitionBuilder: (child, animation, secondaryAnimation) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: SharedAxisTransitionType.scaled,
return FadeTransition(
opacity: animation,
child: child,
);
},
Expand Down

0 comments on commit e60f35d

Please sign in to comment.