-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathets_view.dart
86 lines (78 loc) · 2.61 KB
/
ets_view.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
// Project imports:
import 'package:notredame/features/app/analytics/remote_config_service.dart';
import 'package:notredame/features/app/widgets/base_scaffold.dart';
import 'package:notredame/features/ets/events/news/news_view.dart';
import 'package:notredame/features/ets/quick-link//quick_links_view.dart';
import 'package:notredame/utils/locator.dart';
class ETSView extends StatefulWidget {
@override
_ETSViewState createState() => _ETSViewState();
}
class _ETSViewState extends State<ETSView> {
final RemoteConfigService _remoteConfigService =
locator<RemoteConfigService>();
List<Widget> tabsView = [NewsView(), QuickLinksView()];
@override
Widget build(BuildContext context) {
if (!_remoteConfigService.helloFeatureToggle) {
return BaseScaffold(
appBar: _buildAppBar(context),
body: QuickLinksView(),
);
}
final List<String> tabs = [
AppIntl.of(context)!.news_title,
AppIntl.of(context)!.useful_link_title
];
return BaseScaffold(
isInteractionLimitedWhileLoading: false,
body: DefaultTabController(
length: tabs.length,
child: NestedScrollView(
floatHeaderSlivers: true,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
elevation: 4.0,
automaticallyImplyLeading: false,
pinned: true,
floating: true,
title: Text(AppIntl.of(context)!.title_ets),
forceElevated: innerBoxIsScrolled,
bottom: TabBar(
indicatorColor:
(Theme.of(context).brightness == Brightness.dark)
? Colors.white
: Colors.black26,
labelColor: (Theme.of(context).brightness == Brightness.dark)
? Colors.white
: Colors.black,
tabs: List.generate(
tabs.length,
(index) => Tab(
text: tabs[index],
),
),
),
),
];
},
body: TabBarView(
children: tabsView,
),
),
),
);
}
AppBar _buildAppBar(BuildContext context) {
return AppBar(
title: Text(AppIntl.of(context)!.title_ets),
automaticallyImplyLeading: false,
actions: const [],
);
}
}