-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8776c90
commit 4c46611
Showing
7 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
|
||
## 路由 | ||
|
||
实现路由跳转有几种方式、优劣,想象下使用场景 | ||
实现路由跳转有几种方式、优劣,想象下使用场景。现在路由切换时的渲染处理是否有问题?怎么提升性能 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class SelfBottomNav extends StatelessWidget { | ||
final int index; | ||
SelfBottomNav({ @required this.index }); | ||
@override | ||
Widget build(BuildContext context) { | ||
return BottomNavigationBar( | ||
currentIndex: index, | ||
onTap: (int index) { | ||
switch (index) { | ||
case 1: | ||
Navigator.pushReplacementNamed(context, '/'); | ||
// Navigator.pushNamed(context, '/'); | ||
break; | ||
case 2: | ||
Navigator.pushReplacementNamed(context, '/cv'); | ||
// Navigator.pushNamed(context, '/cv'); | ||
break; | ||
default: | ||
Navigator.pushReplacementNamed(context, '/'); | ||
// Navigator.pushNamed(context, '/'); | ||
} | ||
}, | ||
items: <BottomNavigationBarItem>[ | ||
BottomNavigationBarItem( | ||
icon: new Icon(Icons.book), | ||
title: new Text('Blog'), | ||
), | ||
BottomNavigationBarItem( | ||
icon: new Icon(Icons.image), | ||
title: new Text('没开通'), | ||
), | ||
BottomNavigationBarItem( | ||
icon: new Icon(Icons.work), | ||
title: new Text('CV'), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../components/bottom_nav.dart'; | ||
|
||
class CurriculumVitae extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('简历'), | ||
), | ||
bottomNavigationBar: SelfBottomNav(index: 2), | ||
body: Text('简历'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
const String defaultCoverUrl = 'https://vecchio.top/images/cover/wallhaven-851_1537242430407.jpg'; | ||
|
||
class ArticleUtils { | ||
static const String host = 'https://vecchio.top'; | ||
|
||
static const String defaultCoverUrl = '${ArticleUtils.host}/images/cover/wallhaven-851_1537242430407.jpg'; | ||
|
||
static String getCoverUrl(String coverUrl) { | ||
RegExp exp = RegExp('^(https?:)?//'); | ||
String articleCover = coverUrl != null | ||
? exp.hasMatch(coverUrl) | ||
? coverUrl | ||
: 'https://vecchio.top${coverUrl}' | ||
: defaultCoverUrl; | ||
: (ArticleUtils.host + coverUrl) | ||
: ArticleUtils.defaultCoverUrl; | ||
return articleCover; | ||
} | ||
} |