flutter實現(xiàn)仿boss直聘功能
Flutter是Google使用Dart語言開發(fā)的移動應(yīng)用開發(fā)框架,使用一套Dart代碼就能構(gòu)建高性能、高保真的iOS和Android應(yīng)用程序,并且在排版、圖標、滾動、點擊等方面實現(xiàn)零差異。
2年前,RN剛出來時做了個仿拉鉤的demo,react-native-lagou.
這次flutter來了,想感受一下,索性用目前flutter的版本寫的一個仿boss直聘應(yīng)用。
時間有限,沒完全仿照,去掉了一些功能,但是界面風(fēng)格一致,有參考價值。
github地址:flutter仿boss直聘.
感悟
- 與一些文章里介紹的非常相似,如果會RN,那么學(xué)起來會很快,flutter借鑒了RN的組件化思想,路由機制,狀態(tài)機等。
- Dart語法有些奇葩,但掌握之后,開發(fā)效率會很快,整個demo加起來開發(fā)了2天不到。
- 可以同時在android和ios運行。
- 性能很快,超過RN,因為沒有bridge層。
- 還是要多看官方文檔和源碼,才能碰到問題解決。
- IDE還不是很友好,hot reload有時無效。
- 還是比RN要復(fù)雜一些的。
先上效果
部署到手機
確保flutter正確安裝之后,進入目錄運行flutter run --release
環(huán)境問題
如果flutter環(huán)境有問題,在.bash_profile里加上如下內(nèi)容
export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn export PATH=`pwd`/flutter/bin:$PATH
涉及技術(shù)點
1.Theme主題設(shè)置
theme: new ThemeData( primaryIconTheme: const IconThemeData(color: Colors.white), brightness: Brightness.light, primaryColor: new Color.fromARGB(255, 0, 215, 198), accentColor: Colors.cyan[300], )
2.自定義TabBar
@override Widget build(BuildContext context) { assert(debugCheckHasMaterial(context)); double height = _kTextAndIconTabHeight; Widget label = new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ new Container( child: new Image( image: new AssetImage(this.icon), height: 30.0, width: 30.0, ), margin: const EdgeInsets.only(bottom: _kMarginBottom), ), _buildLabelText() ] ); }
3.MD風(fēng)格及一些組件應(yīng)用
new SliverAppBar( expandedHeight: _appBarHeight, pinned: _appBarBehavior == AppBarBehavior.pinned, floating: _appBarBehavior == AppBarBehavior.floating || _appBarBehavior == AppBarBehavior.snapping, snap: _appBarBehavior == AppBarBehavior.snapping, flexibleSpace: new FlexibleSpaceBar( title: new Text(_company.name, style: new TextStyle(color: Colors.white)), background: new Stack( fit: StackFit.expand, children: <Widget>[ new Image.network( 'https://img.bosszhipin.com/beijin/mcs/chatphoto/20170725/861159df793857d6cb984b52db4d4c9c.jpg', fit: BoxFit.cover, height: _appBarHeight, ), ], ), ), )
4.解決了官方demo里路由跳轉(zhuǎn)效果卡頓的問題
Navigator.of(context).push(new PageRouteBuilder( opaque: false, pageBuilder: (BuildContext context, _, __) { return new CompanyDetail(company); }, transitionsBuilder: (_, Animation<double> animation, __, Widget child) { return new FadeTransition( opacity: animation, child: new SlideTransition(position: new Tween<Offset>( begin: const Offset(0.0, 1.0), end: Offset.zero, ).animate(animation), child: child), ); } ))
TODO
- 下拉篩選組件
- mock server,模擬真實請求
- 分頁
- 目錄結(jié)構(gòu)調(diào)整,更符合生產(chǎn)環(huán)境
- viewpager輪播圖
- 路由機制封裝
總結(jié)
以上所述是小編給大家介紹的flutter實現(xiàn)仿boss直聘,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
Android實現(xiàn)捕獲未知異常并提交給服務(wù)器的方法
這篇文章主要介紹了Android實現(xiàn)捕獲未知異常并提交給服務(wù)器的方法,涉及Android的異常與錯誤處理機制相關(guān)操作技巧,需要的朋友可以參考下2016-08-08分享10個很棒的學(xué)習(xí)Android開發(fā)的網(wǎng)站
我推薦的網(wǎng)站,都是我在學(xué)習(xí)Android 開發(fā)過程中發(fā)現(xiàn)的好網(wǎng)站,給初學(xué)者一些建議,少走一些彎路2015-03-03Android編程使用Service實現(xiàn)Notification定時發(fā)送功能示例
這篇文章主要介紹了Android編程使用Service實現(xiàn)Notification定時發(fā)送功能,涉及Android服務(wù)Service控制通知的發(fā)送功能相關(guān)操作技巧,需要的朋友可以參考下2017-08-08