Skip to content

Commit

Permalink
redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Katsuba committed Nov 16, 2018
1 parent d560419 commit f2e7611
Show file tree
Hide file tree
Showing 14 changed files with 349 additions and 228 deletions.
8 changes: 4 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Expand Up @@ -13,7 +13,7 @@
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
917B9F73219DE6D7008450E0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 917B9F72219DE6D7008450E0 /* GoogleService-Info.plist */; };
91805D65219F3C0B007D7302 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 91805D64219F3C0B007D7302 /* GoogleService-Info.plist */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
Expand Down Expand Up @@ -47,7 +47,7 @@
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
917B9F72219DE6D7008450E0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
91805D64219F3C0B007D7302 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -131,7 +131,7 @@
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
917B9F72219DE6D7008450E0 /* GoogleService-Info.plist */,
91805D64219F3C0B007D7302 /* GoogleService-Info.plist */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
Expand Down Expand Up @@ -215,7 +215,7 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
917B9F73219DE6D7008450E0 /* GoogleService-Info.plist in Resources */,
91805D65219F3C0B007D7302 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
21 changes: 18 additions & 3 deletions lib/main.dart
Expand Up @@ -14,9 +14,24 @@ class MyApp extends StatelessWidget {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.pink[700],
fontFamily: 'Raleway'),
brightness: Brightness.dark,
fontFamily: 'Raleway',
primaryColor: Colors.pink.shade600,
scaffoldBackgroundColor: Colors.grey.shade800,
cardColor: Colors.black12,
buttonColor: Colors.pink.shade700,
canvasColor: Colors.grey.shade700,
accentTextTheme: TextTheme(
button: TextStyle(
color: Colors.pink.shade200
)
),
inputDecorationTheme: InputDecorationTheme(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade700)
),
)
),
routes: {
Routes.Home: (context) => HomePage(),
Routes.About: (context) => AboutPage()
Expand Down
8 changes: 3 additions & 5 deletions lib/pages/about.dart
Expand Up @@ -7,13 +7,11 @@ class AboutPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
appBar: FnBar(
title: Wrap(
children: <Widget>[Text('About '), AppTitle()],
children: <Widget>[Text('About '), FnTitle()],
),
actions: <Widget>[
GithubButton()
],
actions: <Widget>[GithubButton()],
),
body: ListView(
children: <Widget>[
Expand Down
77 changes: 54 additions & 23 deletions lib/pages/home.dart
Expand Up @@ -6,38 +6,69 @@ class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);

@override
_HomePageState createState() => new _HomePageState();
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
StreamController<FilterChangeEvent> _changeController =
new StreamController<FilterChangeEvent>();
StreamController<FilterChangeEvent>();

@override
Widget build(BuildContext context) {
return new Scaffold(
drawer: AppDrawer(),
appBar: new AppBar(
actions: <Widget>[
GithubButton()
],
title: AppTitle(),
),
body: Padding(
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 15.0),
child: Column(
children: <Widget>[
Filter(
onChange: (event) {
_changeController.add(event);
return Scaffold(
drawer: FnDrawer(),
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
child: SliverToBoxAdapter(
child: FnBar(actions: <Widget>[GithubButton()])),
),
];
},
body: SafeArea(
top: false,
bottom: false,
child: Builder(
builder: (BuildContext context) {
return CustomScrollView(
key: PageStorageKey<String>('name'),
slivers: <Widget>[
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
),
SliverToBoxAdapter(
child: Filter(
onChange: (event) {
_changeController.add(event);
},
),
),
SliverPadding(
padding: const EdgeInsets.all(8.0),
sliver: NewsList(
changes: _changeController.stream,
)),
],
);
},
),
NewsList(
changes: _changeController.stream,
)
],
),
),
)),
// child: Column(
// children: <Widget>[
// Filter(
// onChange: (event) {
// _changeController.add(event);
// },
// ),
// NewsList(
// changes: _changeController.stream,
// )
// ],
// ),
);
}
}
41 changes: 0 additions & 41 deletions lib/widgets/app_drawer.dart

This file was deleted.

93 changes: 46 additions & 47 deletions lib/widgets/filter.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:frontend_notes/enums/enums.dart';
import './fn_card.dart';

class FilterChangeEvent {
Languages language;
Expand Down Expand Up @@ -53,55 +54,53 @@ class _FilterState extends State<Filter> {

@override
Widget build(BuildContext context) {
return Column(children: <Widget>[
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.45,
padding: EdgeInsets.only(
right: MediaQuery.of(context).size.width * 0.05),
child: new InputDecorator(
decoration: const InputDecoration(
labelText: 'Language',
),
child: new DropdownButtonHideUnderline(
child: DropdownButton(
isDense: true,
value: _language,
items: widget.languages
.map((lang) => DropdownMenuItem<Languages>(
value: lang,
child: Text(lang.value.toUpperCase()),
))
.toList(),
onChanged: (value) => onChange(language: value),
),
))),
Container(
width: MediaQuery.of(context).size.width * 0.45,
padding:
EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.05),
child: new InputDecorator(
decoration: const InputDecoration(
labelText: 'Sort by',
return Container(
padding: EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.only(left: 6.0, right: 8.0),
child: InputDecorator(
decoration: const InputDecoration(labelText: 'Language'),
child: DropdownButtonHideUnderline(
child: DropdownButton(
isDense: true,
value: _language,
items: widget.languages
.map((lang) => DropdownMenuItem<Languages>(
value: lang,
child: Text(lang.value.toUpperCase()),
))
.toList(),
onChanged: (value) => onChange(language: value),
),
)),
),
child: new DropdownButtonHideUnderline(
child: new DropdownButton<SortBy>(
value: _sortBy,
isDense: true,
onChanged: (value) => onChange(sortBy: value),
items: widget.sortBy
.map((sortBy) => DropdownMenuItem<SortBy>(
value: sortBy,
child: Text(sortBy.toString()),
))
.toList(),
),
Expanded(
child: Container(
padding: EdgeInsets.only(left: 6.0, right: 8.0),
child: InputDecorator(
decoration: const InputDecoration(
labelText: 'Sort by',
),
child: DropdownButtonHideUnderline(
child: DropdownButton<SortBy>(
value: _sortBy,
isDense: true,
onChanged: (value) => onChange(sortBy: value),
items: widget.sortBy
.map((sortBy) => DropdownMenuItem<SortBy>(
value: sortBy,
child: Text(sortBy.toString()),
))
.toList(),
),
),
),
),
)
],
)
]);
))
],
));
}
}
31 changes: 31 additions & 0 deletions lib/widgets/fn_bar.dart
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import './fn_title.dart';

class FnBar extends StatelessWidget implements PreferredSizeWidget {
final Widget title;
final List<Widget> actions;
final bool automaticallyImplyLeading;
final Widget leading;

FnBar(
{Key key,
this.title,
this.actions,
this.automaticallyImplyLeading = true,
this.leading})
: super(key: key);

@override
Widget build(BuildContext context) {
return AppBar(
elevation: 0,
title: title ?? FnTitle(),
actions: actions,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
automaticallyImplyLeading: automaticallyImplyLeading,
leading: leading);
}

@override
Size get preferredSize => new Size.fromHeight(kToolbarHeight);
}
26 changes: 26 additions & 0 deletions lib/widgets/fn_card.dart
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';

class FnCard extends StatelessWidget {
final Widget child;
final bool isFirst;
final bool isLast;

FnCard({Key key, this.child, this.isFirst = false, this.isLast = false})
: super(key: key);

@override
Widget build(BuildContext context) {
return Card(
elevation: 1,
margin: EdgeInsets.only(
left: 4.0,
right: 4.0,
top: isFirst ? 8.0 : 1,
bottom: isLast ? 8.0 : 1),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(isFirst ? 16.0 : 0),
bottom: Radius.circular(isLast ? 16.0 : 0))),
child: child);
}
}

0 comments on commit f2e7611

Please sign in to comment.