-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomScreen.dart
74 lines (65 loc) · 2.29 KB
/
CustomScreen.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
import 'package:course_swap/TabBarMaterialWidget.dart';
import 'package:flutter/material.dart';
import 'CourseCard.dart';
class CustomScreen extends StatefulWidget {
int index=0;
String header='hi';
Widget SliverListWidget;
CustomScreen(this.header, this.SliverListWidget, );
@override
_CustomScreenState createState() => _CustomScreenState();
}
class _CustomScreenState extends State<CustomScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade900,
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: (){Navigator.pushNamed(context, '/req');}
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
actions: [TextButton(child: Icon(Icons.settings), onPressed: (){},style: TextButton.styleFrom(primary: Colors.white, splashFactory: InkSplash.splashFactory),), TextButton(child: Icon(Icons.info), onPressed: (){},)],
floating: true,
expandedHeight: 120.0,
flexibleSpace: const FlexibleSpaceBar(
title: Text('Course Swap'),
background: Image(image: NetworkImage('https://upload.wikimedia.org/wikipedia/en/thumb/d/d3/BITS_Pilani-Logo.svg/1200px-BITS_Pilani-Logo.svg.png')),
),
),
SliverToBoxAdapter(
child: SizedBox(
height: 20,
child: Padding(
padding: EdgeInsets.all(8.0),
child: Center(
child: Text(widget.header, style: TextStyle(fontSize: 20),),
),
),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return widget.SliverListWidget;
},
childCount: 5,
),
),
],
),
bottomNavigationBar: TabBarMaterialWidget(
index: widget.index,
onChangedTab: onChangedTab,
)
);
}
void onChangedTab(int index) {
setState(() {
this.widget.index = index;
});
}
}