diff --git a/lib/home.dart b/lib/home.dart index c0f74732..fa025c73 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -49,7 +49,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { if ((await SharedPreferences.getInstance()).getBool('popup') ?? true) { await showDialog( context: context, - builder: (context) => PopUp(), + builder: (context) => const PopUp(), ); } }, @@ -75,7 +75,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { PreferredSizeWidget _buildHomeAppBar() { return PreferredSize( - preferredSize: Size.fromHeight(5), + preferredSize: const Size.fromHeight(5), child: AppBar( flexibleSpace: SafeArea(child: Container(color: OTLColor.pinksMain, height: 5.0)), @@ -89,7 +89,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { PreferredSizeWidget _buildTimeTableAppBar() { return PreferredSize( - preferredSize: Size.fromHeight(kToolbarHeight + 5), + preferredSize: const Size.fromHeight(kToolbarHeight + 5), child: SafeArea( child: Container( color: OTLColor.pinksLight, @@ -138,14 +138,15 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { tapEffectColorRatio: 0.04, onTap: () => Navigator.push(context, buildCourseSearchPageRoute()), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + padding: + const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Row( children: [ SvgPicture.asset('assets/icons/search.svg', height: 24.0, width: 24.0, - colorFilter: - ColorFilter.mode(OTLColor.pinksMain, BlendMode.srcIn)), + colorFilter: const ColorFilter.mode( + OTLColor.pinksMain, BlendMode.srcIn)), const SizedBox(width: 12.0), Expanded( child: context.watch().courseSearchquery, @@ -169,7 +170,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { PreferredSizeWidget _buildReviewAppBar() { return PreferredSize( - preferredSize: Size.fromHeight(kToolbarHeight + 5), + preferredSize: const Size.fromHeight(kToolbarHeight + 5), child: SafeArea( child: Container( color: OTLColor.pinksLight, @@ -224,7 +225,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { final layerTop = constraints.biggest.height; final layerAnimation = RelativeRectTween( begin: RelativeRect.fromLTRB(0, layerTop, 0, -layerTop), - end: RelativeRect.fromLTRB(0, 0, 0, 0), + end: const RelativeRect.fromLTRB(0, 0, 0, 0), ).animate(CurvedAnimation( parent: _controller, curve: Curves.easeInOut, @@ -244,7 +245,7 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { }); }), TimetablePage(), - DictionaryPage(), + const DictionaryPage(), ReviewPage(), ], ), @@ -273,19 +274,19 @@ class _OTLHomeState extends State with SingleTickerProviderStateMixin { }, items: [ BottomNavigationBarItem( - icon: Icon(Icons.home_outlined), + icon: const Icon(Icons.home_outlined), label: tr("title.home"), ), BottomNavigationBarItem( - icon: Icon(Icons.table_chart_outlined), + icon: const Icon(Icons.table_chart_outlined), label: tr("title.timetable"), ), BottomNavigationBarItem( - icon: Icon(Icons.library_books_outlined), + icon: const Icon(Icons.library_books_outlined), label: tr("title.dictionary"), ), BottomNavigationBarItem( - icon: Icon(Icons.rate_review_outlined), + icon: const Icon(Icons.rate_review_outlined), label: tr("title.review"), ), ], diff --git a/lib/main.dart b/lib/main.dart index 3bd9f187..9534255c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -39,9 +39,9 @@ void main() { runApp( EasyLocalization( - supportedLocales: [Locale('en'), Locale('ko')], + supportedLocales: [const Locale('en'), const Locale('ko')], path: 'assets/translations', - fallbackLocale: Locale('en'), + fallbackLocale: const Locale('en'), child: MultiProvider( providers: [ ChangeNotifierProvider(create: (context) => AuthModel()), @@ -100,7 +100,7 @@ class OTLFirebaseApp extends StatelessWidget { } on Error {} SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle(statusBarColor: Colors.transparent)); + const SystemUiOverlayStyle(statusBarColor: Colors.transparent)); return MaterialApp( builder: (context, child) { @@ -118,7 +118,7 @@ class OTLFirebaseApp extends StatelessWidget { : LoginPage(), routes: { LikedReviewPage.route: (_) => LikedReviewPage(), - MyReviewPage.route: (_) => MyReviewPage(), + MyReviewPage.route: (_) => const MyReviewPage(), LectureDetailPage.route: (_) => LectureDetailPage(), CourseDetailPage.route: (_) => CourseDetailPage(), }, diff --git a/lib/pages/course_detail_page.dart b/lib/pages/course_detail_page.dart index fa7247a1..092e431f 100644 --- a/lib/pages/course_detail_page.dart +++ b/lib/pages/course_detail_page.dart @@ -27,7 +27,8 @@ class CourseDetailPage extends StatelessWidget { Widget build(BuildContext context) { final CourseDetailModel courseDetailModel = context.watch(); - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Scaffold( appBar: buildAppBar( @@ -46,8 +47,8 @@ class CourseDetailPage extends StatelessWidget { ), child: context.select((model) => model.hasData) ? _buildBody(context) - : Center( - child: const CircularProgressIndicator(), + : const Center( + child: CircularProgressIndicator(), ), ), ); @@ -124,7 +125,8 @@ class CourseDetailPage extends StatelessWidget { ChoiceChip _buildChoiceChip( BuildContext context, String selectedFilter, Professor? professor) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return ChoiceChip( selectedColor: OTLColor.pinksSub, @@ -206,7 +208,8 @@ class CourseDetailPage extends StatelessWidget { } Column _buildAttribute(BuildContext context, Course course) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Column( children: [ @@ -252,7 +255,8 @@ class CourseDetailPage extends StatelessWidget { final _scrollController = ScrollController(); final years = context.select>((model) => model.years); final courseDetailModel = context.watch(); - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Scrollbar( controller: _scrollController, @@ -299,7 +303,8 @@ class CourseDetailPage extends StatelessWidget { Widget _buildHistoryRow(BuildContext context, List lectures, Set years, int semester, String selectedFilter) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return IntrinsicHeight( child: Row( diff --git a/lib/pages/course_search_page.dart b/lib/pages/course_search_page.dart index ceb7373c..bc5de1ff 100644 --- a/lib/pages/course_search_page.dart +++ b/lib/pages/course_search_page.dart @@ -50,7 +50,7 @@ class _CourseSearchPageState extends State { IconTextButton( onTap: () => Navigator.pop(context), icon: Icons.navigate_before, - padding: EdgeInsets.fromLTRB(0, 16, 16, 16), + padding: const EdgeInsets.fromLTRB(0, 16, 16, 16), ), Expanded( child: SearchTextfield( @@ -112,7 +112,8 @@ class _CourseSearchPageState extends State { style: bodyBold.copyWith(color: OTLColor.pinksMain), ), style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(OTLColor.grayF), + backgroundColor: + const MaterialStatePropertyAll(OTLColor.grayF), shape: MaterialStatePropertyAll( RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), @@ -121,7 +122,7 @@ class _CourseSearchPageState extends State { ), ), ), - SizedBox( + const SizedBox( width: 12, ), Expanded( diff --git a/lib/pages/dictionary_page.dart b/lib/pages/dictionary_page.dart index 38bd17cf..7808d10e 100644 --- a/lib/pages/dictionary_page.dart +++ b/lib/pages/dictionary_page.dart @@ -49,7 +49,7 @@ class _DictionaryPageState extends State { controller: _scrollController, child: ListView.separated( controller: _scrollController, - padding: EdgeInsets.all(12.0), + padding: const EdgeInsets.all(12.0), itemCount: searchModel.courses?.length ?? 0, itemBuilder: (context, index) => CourseBlock( course: searchModel.courses![index], @@ -60,7 +60,8 @@ class _DictionaryPageState extends State { Navigator.push(context, buildCourseDetailPageRoute()); }, ), - separatorBuilder: (context, index) => SizedBox(height: 8.0), + separatorBuilder: (context, index) => + const SizedBox(height: 8.0), ), ); } @@ -74,7 +75,7 @@ Widget _buildCopyRight() { return Text.rich( TextSpan( style: labelRegular.copyWith(color: OTLColor.grayA), - children: [ + children: const [ TextSpan(text: 'otlplus@sparcs.org'), TextSpan(text: '\n'), TextSpan(text: '© 2023 SPARCS OTL Team'), diff --git a/lib/pages/lecture_detail_page.dart b/lib/pages/lecture_detail_page.dart index 541a6ed0..d159c488 100644 --- a/lib/pages/lecture_detail_page.dart +++ b/lib/pages/lecture_detail_page.dart @@ -37,7 +37,8 @@ class LectureDetailPage extends StatelessWidget { Widget build(BuildContext context) { final LectureDetailModel lectureDetailModel = context.watch(); - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Scaffold( appBar: buildAppBar( @@ -57,8 +58,8 @@ class LectureDetailPage extends StatelessWidget { child: context.select((model) => model.hasData) ? _buildBody(context) - : Center( - child: const CircularProgressIndicator(), + : const Center( + child: CircularProgressIndicator(), ), ), ); @@ -115,7 +116,7 @@ class LectureDetailPage extends StatelessWidget { "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?"), actions: [ IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.cancel'.tr(), color: OTLColor.pinksMain, onTap: () { @@ -124,7 +125,7 @@ class LectureDetailPage extends StatelessWidget { }, ), IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.add'.tr(), color: OTLColor.pinksMain, onTap: () { @@ -165,7 +166,7 @@ class LectureDetailPage extends StatelessWidget { IconTextButton( onTap: () => FlutterWebBrowser.openWebPage( url: _getSyllabusUrl(lecture), - customTabsOptions: CustomTabsOptions( + customTabsOptions: const CustomTabsOptions( colorScheme: CustomTabsColorScheme.light, defaultColorSchemeParams: CustomTabsColorSchemeParams( toolbarColor: OTLColor.pinksLight), @@ -174,7 +175,7 @@ class LectureDetailPage extends StatelessWidget { showTitle: true, urlBarHidingEnabled: true, ), - safariVCOptions: SafariViewControllerOptions( + safariVCOptions: const SafariViewControllerOptions( barCollapsingEnabled: true, dismissButtonStyle: SafariViewControllerDismissButtonStyle.close, modalPresentationCapturesStatusBarAppearance: true, @@ -332,7 +333,8 @@ class LectureDetailPage extends StatelessWidget { } Widget _buildAttributes(BuildContext context, Lecture lecture) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Column( children: [ diff --git a/lib/pages/lecture_search_page.dart b/lib/pages/lecture_search_page.dart index 8713d6c5..1e291f02 100644 --- a/lib/pages/lecture_search_page.dart +++ b/lib/pages/lecture_search_page.dart @@ -51,7 +51,7 @@ class _LectureSearchPageState extends State { IconTextButton( onTap: () => Navigator.pop(context), icon: Icons.navigate_before, - padding: EdgeInsets.fromLTRB(0, 16, 16, 16), + padding: const EdgeInsets.fromLTRB(0, 16, 16, 16), ), Expanded( child: SearchTextfield( @@ -112,7 +112,8 @@ class _LectureSearchPageState extends State { style: bodyBold.copyWith(color: OTLColor.pinksMain), ), style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(OTLColor.grayF), + backgroundColor: + const MaterialStatePropertyAll(OTLColor.grayF), shape: MaterialStatePropertyAll( RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), @@ -121,7 +122,7 @@ class _LectureSearchPageState extends State { ), ), ), - SizedBox( + const SizedBox( width: 12, ), Expanded( diff --git a/lib/pages/liked_review_page.dart b/lib/pages/liked_review_page.dart index 114453d1..cd8e89f5 100644 --- a/lib/pages/liked_review_page.dart +++ b/lib/pages/liked_review_page.dart @@ -74,10 +74,10 @@ class LikedReviewPage extends StatelessWidget { ), SliverList( delegate: SliverChildListDelegate([ - Padding( - padding: const EdgeInsets.only( - top: 4.0, bottom: 12.0), - child: const Center( + const Padding( + padding: + EdgeInsets.only(top: 4.0, bottom: 12.0), + child: Center( child: SizedBox( width: 24, height: 24, diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index a0a3edbf..6fd0a3c0 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -25,8 +25,8 @@ class _LoginPageState extends State { body: Material( child: Stack( children: [ - Center( - child: const CircularProgressIndicator(), + const Center( + child: CircularProgressIndicator(), ), _buildBody(context), ], diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index f4c6ba5f..5f963737 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -79,8 +79,8 @@ class _MainPageState extends State { iconSize: 24, color: OTLColor.pinksMain, tapEffect: 'darken', - padding: - EdgeInsets.fromLTRB(16.0, 16.0, 8.0, 16.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 16.0, 8.0, 16.0), ), IconTextButton( onTap: () => Navigator.push( @@ -89,8 +89,8 @@ class _MainPageState extends State { iconSize: 24, color: OTLColor.pinksMain, tapEffect: 'darken', - padding: - EdgeInsets.fromLTRB(8.0, 16.0, 16.0, 16.0), + padding: const EdgeInsets.fromLTRB( + 8.0, 16.0, 16.0, 16.0), ), ], ) @@ -119,7 +119,7 @@ class _MainPageState extends State { tapEffect: 'darken', color: OTLColor.grayF, child: Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 12.0, vertical: 6.0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -127,7 +127,7 @@ class _MainPageState extends State { SvgPicture.asset('assets/icons/search.svg', height: 24.0, width: 24.0, - colorFilter: ColorFilter.mode( + colorFilter: const ColorFilter.mode( OTLColor.pinksMain, BlendMode.srcIn)), const SizedBox(width: 12.0), @@ -151,16 +151,16 @@ class _MainPageState extends State { Flexible( child: ClipRRect( borderRadius: - BorderRadius.vertical(top: Radius.circular(16.0)), - child: Container( - constraints: const BoxConstraints.expand(), - child: CustomScrollView( - reverse: true, - slivers: [ - SliverFillRemaining( - hasScrollBody: false, - child: ColoredBox( - color: Colors.white, + const BorderRadius.vertical(top: Radius.circular(16.0)), + child: ColoredBox( + color: Colors.white, + child: Container( + constraints: const BoxConstraints.expand(), + child: CustomScrollView( + reverse: true, + slivers: [ + SliverFillRemaining( + hasScrollBody: false, child: Padding( padding: const EdgeInsets.symmetric( horizontal: 16.0, @@ -181,7 +181,7 @@ class _MainPageState extends State { _buildDivider(), ], ), - Spacer(), + const Spacer(), Column( children: [ _buildLogo(), @@ -194,46 +194,9 @@ class _MainPageState extends State { ), ), ), - ), - ], - ) - - // SingleChildScrollView( - // child: ColoredBox( - // color: Colors.white, - // child: Padding( - // padding: const EdgeInsets.symmetric( - // horizontal: 16.0, - // vertical: 16.0, - // ), - // child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Column( - // children: [ - // _buildTimetable(infoModel.user, semester, now), - // const SizedBox(height: 24.0), - // _buildDivider(), - // const SizedBox(height: 24.0), - // _buildSchedule(now, infoModel.currentSchedule), - // const SizedBox(height: 24.0), - // _buildDivider(), - // ], - // ), - // Column( - // children: [ - // _buildLogo(), - // const SizedBox(height: 4.0), - // _buildCopyRight(), - // _buildTextButtons(context), - // ], - // ) - // ], - // ), - // ), - // ), - // ), - ), + ], + )), + ), ), ), ], @@ -257,7 +220,7 @@ class _MainPageState extends State { }, text: 'title.privacy'.tr(), textStyle: labelRegular.copyWith(color: OTLColor.gray75), - padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), + padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), tapEffect: 'lighten', ), IconTextButton( @@ -266,7 +229,7 @@ class _MainPageState extends State { }, text: 'title.credit'.tr(), textStyle: labelRegular.copyWith(color: OTLColor.gray75), - padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), + padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), tapEffect: 'lighten', ), ], @@ -284,7 +247,7 @@ class _MainPageState extends State { return Text.rich( TextSpan( style: labelRegular.copyWith(color: OTLColor.gray75), - children: [ + children: const [ TextSpan(text: 'otlplus@sparcs.org'), TextSpan(text: '\n'), TextSpan(text: '© 2023 SPARCS OTL Team'), @@ -302,7 +265,8 @@ class _MainPageState extends State { } Widget _buildSchedule(DateTime now, Map? currentSchedule) { - final isEn = EasyLocalization.of(context)!.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)!.currentLocale == const Locale('en'); return Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -314,7 +278,6 @@ class _MainPageState extends State { args: getRemainedTime( currentSchedule["time"].difference(now) as Duration)), style: titleRegular, - // ignore: unnecessary_null_comparison ), const SizedBox(height: 4.0), Text.rich( @@ -323,16 +286,13 @@ class _MainPageState extends State { children: [ TextSpan( style: bodyBold, - text: - // ignore: unnecessary_null_comparison - (currentSchedule == null) - ? "-" - : (currentSchedule["title"]), + text: (currentSchedule == null) + ? "-" + : (currentSchedule["title"]), ), const TextSpan(text: " "), TextSpan( style: bodyBold, - // ignore: unnecessary_null_comparison text: (currentSchedule == null) ? "" : (isEn @@ -341,7 +301,6 @@ class _MainPageState extends State { ), const TextSpan(text: " "), TextSpan( - // ignore: unnecessary_null_comparison text: (currentSchedule == null) ? "" : DateFormat("yyyy.MM.dd") diff --git a/lib/pages/my_review_page.dart b/lib/pages/my_review_page.dart index 0a88511e..564cf619 100644 --- a/lib/pages/my_review_page.dart +++ b/lib/pages/my_review_page.dart @@ -107,7 +107,7 @@ class MyReviewPage extends StatelessWidget { Expanded( child: _buildLectureBlock(context, user, lectures.last), ), - Expanded(child: const SizedBox()), + const Expanded(child: SizedBox()), ], )); } diff --git a/lib/pages/people_page.dart b/lib/pages/people_page.dart index 2e38e0a5..8126ae65 100644 --- a/lib/pages/people_page.dart +++ b/lib/pages/people_page.dart @@ -13,7 +13,7 @@ class PeoplePage extends StatelessWidget { return Scaffold( appBar: buildAppBar(context, 'title.credit'.tr(), false, true), body: Padding( - padding: EdgeInsets.all(16.0), + padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -34,7 +34,7 @@ class PeoplePage extends StatelessWidget { _buildContainer(String title) { return Container( - padding: EdgeInsets.symmetric(vertical: 6.0), + padding: const EdgeInsets.symmetric(vertical: 6.0), decoration: BoxDecoration( color: OTLColor.pinksLight, borderRadius: BorderRadius.circular(16.0), diff --git a/lib/pages/privacy_page.dart b/lib/pages/privacy_page.dart index dc6347dd..9661d01d 100644 --- a/lib/pages/privacy_page.dart +++ b/lib/pages/privacy_page.dart @@ -12,7 +12,7 @@ class PrivacyPage extends StatelessWidget { return Scaffold( appBar: buildAppBar(context, 'title.privacy'.tr(), false, true), body: Padding( - padding: EdgeInsets.all(16.0), + padding: const EdgeInsets.all(16.0), child: ListView( children: [ Text.rich( @@ -25,9 +25,9 @@ class PrivacyPage extends StatelessWidget { 12, (index) => TextSpan( children: [ - TextSpan(text: '\n'), + const TextSpan(text: '\n'), TextSpan(text: privacyTitles[index], style: bodyBold), - TextSpan(text: '\n'), + const TextSpan(text: '\n'), TextSpan(text: privacyTexts[index]), ], ), diff --git a/lib/pages/review_page.dart b/lib/pages/review_page.dart index 68f51b6f..7cca2c35 100644 --- a/lib/pages/review_page.dart +++ b/lib/pages/review_page.dart @@ -93,9 +93,9 @@ class _ReviewPageState extends State { ), SliverList( delegate: SliverChildListDelegate([ - Padding( - padding: const EdgeInsets.only(top: 4.0, bottom: 12.0), - child: const Center( + const Padding( + padding: EdgeInsets.only(top: 4.0, bottom: 12.0), + child: Center( child: SizedBox( width: 24, height: 24, @@ -144,9 +144,9 @@ class _ReviewPageState extends State { ), SliverList( delegate: SliverChildListDelegate([ - Padding( - padding: const EdgeInsets.only(top: 4.0, bottom: 12.0), - child: const Center( + const Padding( + padding: EdgeInsets.only(top: 4.0, bottom: 12.0), + child: Center( child: SizedBox( width: 24, height: 24, diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index c7ca0c8d..5321c761 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -86,21 +86,17 @@ class SettingsPage extends StatelessWidget { style: bodyRegular, ), actions: [ - TextButton( - child: Text( - "common.cancel".tr(), - style: bodyRegular, - ), - onPressed: () { + IconTextButton( + text: "common.cancel".tr(), + textStyle: bodyRegular, + onTap: () { Navigator.pop(context); }, ), - TextButton( - child: Text( - "common.delete".tr(), - style: bodyRegular, - ), - onPressed: () { + IconTextButton( + text: "common.delete".tr(), + textStyle: bodyRegular, + onTap: () { context .read() .clearAllValues() @@ -122,7 +118,7 @@ class SettingsPage extends StatelessWidget { style: bodyRegular, ), IconTextButton( - padding: EdgeInsets.fromLTRB(0, 4, 10, 4), + padding: const EdgeInsets.fromLTRB(0, 4, 10, 4), onTap: () => launchUrl(Uri.parse("mailto:$contactEmail")), text: contactEmail, textStyle: bodyRegular.copyWith(color: OTLColor.pinksMain), diff --git a/lib/pages/timetable_page.dart b/lib/pages/timetable_page.dart index 26fa50b0..b09525a3 100644 --- a/lib/pages/timetable_page.dart +++ b/lib/pages/timetable_page.dart @@ -30,8 +30,8 @@ class _TimetablePageState extends State { Widget build(BuildContext context) { if (context.select((model) => model.isLoaded)) return _buildBody(context); - return Center( - child: const CircularProgressIndicator(), + return const Center( + child: CircularProgressIndicator(), ); } @@ -61,7 +61,7 @@ class _TimetablePageState extends State { color: OTLColor.pinksLight, child: Container( padding: const EdgeInsets.symmetric(vertical: 16), - decoration: BoxDecoration( + decoration: const BoxDecoration( color: OTLColor.grayF, borderRadius: BorderRadius.only( topLeft: Radius.circular(16)), @@ -77,8 +77,8 @@ class _TimetablePageState extends State { Navigator.push( context, buildLectureSearchPageRoute()); }, - child: Padding( - padding: const EdgeInsets.fromLTRB(12, 18, 16, 18), + child: const Padding( + padding: EdgeInsets.fromLTRB(12, 18, 16, 18), child: Icon( Icons.search, size: 24, @@ -186,12 +186,12 @@ class _TimetablePageState extends State { barrierDismissible: false, builder: (context) => AlertDialog( title: Text("common.delete".tr()), - content: Text("timetable.ask_delete_lecture").tr( + content: const Text("timetable.ask_delete_lecture").tr( args: [lecture.title], ), actions: [ IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.cancel'.tr(), color: OTLColor.pinksMain, onTap: () { @@ -200,7 +200,7 @@ class _TimetablePageState extends State { }, ), IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.delete'.tr(), color: OTLColor.pinksMain, onTap: () { @@ -241,11 +241,6 @@ class _TimetablePageState extends State { final timetableModel = context.read(); timetableModel.createTimetable( lectures: timetableModel.currentTimetable.lectures); - /*if (_isSearchOpened) return; - setState(() { - _isSearchOpened = true; - _selectedLecture = null; - });*/ }, onDeleteTap: () { showGeneralDialog( @@ -283,7 +278,7 @@ class _TimetablePageState extends State { 'timetable.ask_delete_tab'.tr(args: [ 'timetable.tab'.tr(args: [i.toString()]) ]), - style: TextStyle( + style: const TextStyle( fontSize: 12, ), ), @@ -299,7 +294,7 @@ class _TimetablePageState extends State { color: OTLColor.grayE, child: Text( 'common.cancel'.tr(), - style: TextStyle( + style: const TextStyle( fontSize: 12, fontWeight: FontWeight.w700, ), @@ -319,7 +314,7 @@ class _TimetablePageState extends State { color: OTLColor.pinksMain, child: Text( 'common.delete'.tr(), - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w700, diff --git a/lib/pages/user_page.dart b/lib/pages/user_page.dart index 119f097a..0df8e918 100644 --- a/lib/pages/user_page.dart +++ b/lib/pages/user_page.dart @@ -13,7 +13,8 @@ class UserPage extends StatelessWidget { @override Widget build(BuildContext context) { final user = context.watch().user; - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Scaffold( appBar: buildAppBar(context, 'title.my_information'.tr(), false, true), @@ -70,7 +71,7 @@ class UserPage extends StatelessWidget { color: OTLColor.pinksMain, textStyle: bodyBold, spaceBetween: 8.0, - padding: EdgeInsets.symmetric(horizontal: 16.0), + padding: const EdgeInsets.symmetric(horizontal: 16.0), ), ), ], @@ -101,7 +102,7 @@ class UserPage extends StatelessWidget { return IconTextButtonRaw( data: { 'Padding': { - 'padding': EdgeInsets.symmetric(horizontal: 16.0), + 'padding': const EdgeInsets.symmetric(horizontal: 16.0), 'child': { 'SizedBox': { 'height': 36.0, @@ -118,7 +119,7 @@ class UserPage extends StatelessWidget { }, { 'Padding': { - 'padding': EdgeInsets.symmetric(horizontal: 8.0), + 'padding': const EdgeInsets.symmetric(horizontal: 8.0), 'child': { 'Text': { 'arg': text, @@ -131,7 +132,7 @@ class UserPage extends StatelessWidget { {'Spacer': {}}, { 'Padding': { - 'padding': EdgeInsets.fromLTRB(16, 6, 0, 6), + 'padding': const EdgeInsets.fromLTRB(16, 6, 0, 6), 'child': { 'Icon': { 'arg': Icons.navigate_next, diff --git a/lib/providers/course_search_model.dart b/lib/providers/course_search_model.dart index ad9795f6..71ff057b 100644 --- a/lib/providers/course_search_model.dart +++ b/lib/providers/course_search_model.dart @@ -156,7 +156,7 @@ class CourseSearchModel extends ChangeNotifier { k, (v.isMultiSelect == false && v.options.first.first.selected == true) || v.options.expand((i) => i).every((i) => i.selected == true) - ? Iterable.empty() + ? const Iterable.empty() : v.options .expand((i) => i) .where((i) => i.selected == true) @@ -174,7 +174,7 @@ class CourseSearchModel extends ChangeNotifier { TextSpan( children: [ if (_selectedFilters.length > 0 && _courseSearchText.length > 0) - TextSpan(text: ", "), + const TextSpan(text: ", "), TextSpan(text: _selectedFilters.join(", ")), ], ) diff --git a/lib/providers/hall_of_fame_model.dart b/lib/providers/hall_of_fame_model.dart index c81a917e..b12d0cf7 100644 --- a/lib/providers/hall_of_fame_model.dart +++ b/lib/providers/hall_of_fame_model.dart @@ -35,7 +35,7 @@ class HallOfFameModel extends ChangeNotifier { notifyListeners(); scrollController.animateTo( 0, - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, ); } @@ -54,7 +54,7 @@ class HallOfFameModel extends ChangeNotifier { // 2. Animate Slowly But Safe _scrollController.animateTo( 0, - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, ); } diff --git a/lib/providers/lecture_search_model.dart b/lib/providers/lecture_search_model.dart index 1d917db7..f0ad27d2 100644 --- a/lib/providers/lecture_search_model.dart +++ b/lib/providers/lecture_search_model.dart @@ -128,14 +128,14 @@ class LectureSearchModel extends ChangeNotifier { bool _isSearching = false; bool get isSearching => _isSearching; - Text _lectureSearchquery = Text.rich(TextSpan()); + Text _lectureSearchquery = const Text.rich(TextSpan()); Text get lectureSearchquery => _lectureSearchquery; void updateLectureSearchqeury() { List _selectedFilters = (_lectureFilter.map((k, v) => MapEntry( k, (v.isMultiSelect == false && v.options.first.first.selected == true) || v.options.expand((i) => i).every((i) => i.selected == true) - ? Iterable.empty() + ? const Iterable.empty() : v.options .expand((i) => i) .where((i) => i.selected == true) @@ -150,7 +150,7 @@ class LectureSearchModel extends ChangeNotifier { TextSpan( children: [ if (_selectedFilters.length > 0 && _lectureSearchText.length > 0) - TextSpan(text: ", "), + const TextSpan(text: ", "), TextSpan(text: _selectedFilters.join(", ")), ], ) @@ -189,17 +189,19 @@ class LectureSearchModel extends ChangeNotifier { ]; return Text.rich( TextSpan( - style: TextStyle(fontSize: 14, height: 1.2, letterSpacing: 0.15), + style: const TextStyle(fontSize: 14, height: 1.2, letterSpacing: 0.15), children: [ TextSpan( text: keyword, - style: - TextStyle(fontWeight: FontWeight.bold, color: Colors.black)), + style: const TextStyle( + fontWeight: FontWeight.bold, color: Colors.black)), if (filterOptions.length > 0) - TextSpan(style: TextStyle(color: Color(0xFFAAAAAA)), children: [ - if ((keyword ?? '').length > 0) TextSpan(text: ", "), - TextSpan(text: (filterOptions).join(", ")), - ]) + TextSpan( + style: const TextStyle(color: Color(0xFFAAAAAA)), + children: [ + if ((keyword ?? '').length > 0) const TextSpan(text: ", "), + TextSpan(text: (filterOptions).join(", ")), + ]) ], ), maxLines: 1, diff --git a/lib/providers/settings_model.dart b/lib/providers/settings_model.dart index 8f1e0499..6ab5f7ec 100644 --- a/lib/providers/settings_model.dart +++ b/lib/providers/settings_model.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; -final _kSendCrashlytics = 'sendCrashlytics'; -final _kSendCrashlyticsAnonymously = 'sendCrashlyticsAnonymously'; +const _kSendCrashlytics = 'sendCrashlytics'; +const _kSendCrashlyticsAnonymously = 'sendCrashlyticsAnonymously'; class SettingsModel extends ChangeNotifier { late bool _sendCrashlytics; diff --git a/lib/utils/build_app_bar.dart b/lib/utils/build_app_bar.dart index 92483731..f01477c1 100644 --- a/lib/utils/build_app_bar.dart +++ b/lib/utils/build_app_bar.dart @@ -17,7 +17,7 @@ PreferredSizeWidget buildAppBar( IconTextButton( onTap: () => Navigator.pop(context), icon: Icons.navigate_before, - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), ), ) : null, @@ -30,7 +30,7 @@ PreferredSizeWidget buildAppBar( context, (route) => route.isFirst, ), - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), ), ), ] diff --git a/lib/utils/build_page_route.dart b/lib/utils/build_page_route.dart index 5bcdf2c8..45a3a386 100644 --- a/lib/utils/build_page_route.dart +++ b/lib/utils/build_page_route.dart @@ -84,7 +84,7 @@ Route buildSettingsPageRoute() { Route buildMyReviewPageRoute() { return PageRouteBuilder( - pageBuilder: (_, animation, __) => MyReviewPage(), + pageBuilder: (_, animation, __) => const MyReviewPage(), transitionsBuilder: (_, animation, __, child) { const begin = Offset(1.0, 0.0); const end = Offset.zero; @@ -120,7 +120,8 @@ Route buildLikedReviewPageRoute() { Route buildCourseSearchPageRoute() { return PageRouteBuilder( - pageBuilder: (_, animation, __) => CourseSearchPage(openKeyboard: true), + pageBuilder: (_, animation, __) => + const CourseSearchPage(openKeyboard: true), transitionsBuilder: (_, animation, __, child) { const begin = Offset(1.0, 0.0); const end = Offset.zero; @@ -138,7 +139,8 @@ Route buildCourseSearchPageRoute() { Route buildLectureSearchPageRoute() { return PageRouteBuilder( - pageBuilder: (_, animation, __) => LectureSearchPage(openKeyboard: true), + pageBuilder: (_, animation, __) => + const LectureSearchPage(openKeyboard: true), transitionsBuilder: (_, animation, __, child) { const begin = Offset(1.0, 0.0); const end = Offset.zero; @@ -156,7 +158,7 @@ Route buildLectureSearchPageRoute() { Route buildPrivacyPageRoute() { return PageRouteBuilder( - pageBuilder: (_, animation, __) => PrivacyPage(), + pageBuilder: (_, animation, __) => const PrivacyPage(), transitionsBuilder: (_, animation, __, child) { const begin = Offset(0.0, 1.0); const end = Offset.zero; @@ -174,7 +176,7 @@ Route buildPrivacyPageRoute() { Route buildPeoplePageRoute() { return PageRouteBuilder( - pageBuilder: (_, animation, __) => PeoplePage(), + pageBuilder: (_, animation, __) => const PeoplePage(), transitionsBuilder: (_, animation, __, child) { const begin = Offset(0.0, 1.0); const end = Offset.zero; diff --git a/lib/utils/responsive_button.dart b/lib/utils/responsive_button.dart index b5a258e7..fc8e2ac9 100644 --- a/lib/utils/responsive_button.dart +++ b/lib/utils/responsive_button.dart @@ -164,12 +164,12 @@ Widget renderRawResponsiveWidget(BuildContext context, Map data, return Icon(args['arg'] ?? null, size: args['size'] ?? 24.0, color: Color.lerp( - args['color'] ?? Color(0xFF000000), + args['color'] ?? const Color(0xFF000000), tapEffect == 'darken' - ? Color(0xFF000000) + ? const Color(0xFF000000) : tapEffect == 'lighten' - ? Color(0xFFFFFFFF) - : args['color'] ?? Color(0xFF000000), + ? const Color(0xFFFFFFFF) + : args['color'] ?? const Color(0xFF000000), isTapDowned ? tapEffectColorRatio : 0)); case 'SvgPicture.asset': return SvgPicture.asset(args['arg'] ?? null, @@ -177,12 +177,12 @@ Widget renderRawResponsiveWidget(BuildContext context, Map data, height: args['height'] ?? 24.0, colorFilter: ColorFilter.mode( Color.lerp( - args['color'] ?? Color(0xFF000000), + args['color'] ?? const Color(0xFF000000), tapEffect == 'darken' - ? Color(0xFF000000) + ? const Color(0xFF000000) : tapEffect == 'lighten' - ? Color(0xFFFFFFFF) - : args['color'] ?? Color(0xFF000000), + ? const Color(0xFFFFFFFF) + : args['color'] ?? const Color(0xFF000000), isTapDowned ? tapEffectColorRatio : 0)!, BlendMode.srcIn)); case 'SizedBox': @@ -197,15 +197,16 @@ Widget renderRawResponsiveWidget(BuildContext context, Map data, return Spacer(flex: args['flex'] ?? 1); case 'Text': return Text(args['arg'] ?? '', - style: ((args['style'] ?? TextStyle()) as TextStyle).copyWith( + style: ((args['style'] ?? const TextStyle()) as TextStyle).copyWith( color: Color.lerp( - (args['style'] ?? TextStyle()).color ?? Color(0xFF000000), + (args['style'] ?? const TextStyle()).color ?? + const Color(0xFF000000), tapEffect == 'darken' - ? Color(0xFF000000) + ? const Color(0xFF000000) : tapEffect == 'lighten' - ? Color(0xFFFFFFFF) - : (args['style'] ?? TextStyle()).color ?? - Color(0xFF000000), + ? const Color(0xFFFFFFFF) + : (args['style'] ?? const TextStyle()).color ?? + const Color(0xFF000000), isTapDowned ? tapEffectColorRatio : 0))); case 'Padding': return Padding( @@ -344,9 +345,9 @@ class _BackgroundButtonState extends State { color: Color.lerp( widget.color, widget.tapEffect == 'darken' - ? Color(0xFF000000) + ? const Color(0xFF000000) : widget.tapEffect == 'lighten' - ? Color(0xFFFFFFFF) + ? const Color(0xFFFFFFFF) : widget.color, _isTapDowned ? widget.tapEffectColorRatio : 0)!, child: widget.child, diff --git a/lib/widgets/base_layout.dart b/lib/widgets/base_layout.dart index d8d71ad5..ab3b4c78 100644 --- a/lib/widgets/base_layout.dart +++ b/lib/widgets/base_layout.dart @@ -55,7 +55,7 @@ class _BaseLayoutState extends State { )), Expanded( child: ClipRRect( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(16), topRight: Radius.circular(16)), child: ColoredBox( color: widget.sheetBackgroundColor, @@ -84,7 +84,8 @@ class _BackButton extends StatelessWidget { child: SvgPicture.asset('assets/icons/back.svg', height: 24.0, width: 24.0, - colorFilter: ColorFilter.mode(Color(0xFF000000), BlendMode.srcIn)), + colorFilter: + const ColorFilter.mode(Color(0xFF000000), BlendMode.srcIn)), ), ); } diff --git a/lib/widgets/course_block.dart b/lib/widgets/course_block.dart index 7df17993..7bdd6a82 100644 --- a/lib/widgets/course_block.dart +++ b/lib/widgets/course_block.dart @@ -14,7 +14,8 @@ class CourseBlock extends StatelessWidget { @override Widget build(BuildContext context) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return ClipRRect( borderRadius: BorderRadius.circular(4.0), diff --git a/lib/widgets/expandable_text.dart b/lib/widgets/expandable_text.dart index 19779df8..163c2ac3 100644 --- a/lib/widgets/expandable_text.dart +++ b/lib/widgets/expandable_text.dart @@ -30,8 +30,8 @@ class ExpandableTextState extends State { ), TextSpan( text: " 더보기", - style: - (widget.style ?? TextStyle()).copyWith(color: Colors.black45), + style: (widget.style ?? const TextStyle()) + .copyWith(color: Colors.black45), recognizer: TapGestureRecognizer() ..onTap = () { setState(() => _expanded = true); @@ -44,7 +44,7 @@ class ExpandableTextState extends State { builder: (BuildContext context, BoxConstraints constraints) { assert(constraints.hasBoundedWidth); TextPainter textPainter = TextPainter( - text: TextSpan(text: ""), + text: const TextSpan(text: ""), textDirection: TextDirection.rtl, maxLines: widget.maxLines, ); diff --git a/lib/widgets/hall_of_fame_control.dart b/lib/widgets/hall_of_fame_control.dart index d1fbf772..f436823c 100644 --- a/lib/widgets/hall_of_fame_control.dart +++ b/lib/widgets/hall_of_fame_control.dart @@ -31,7 +31,7 @@ class _HallOfFameControlState extends State { s.year >= 2013 && (s.gradePosting == null || DateTime.now() - .isAfter(s.gradePosting!.add(Duration(days: 30))))) + .isAfter(s.gradePosting!.add(const Duration(days: 30))))) .toList(); _currentSemester = context.read().semeseter; @@ -40,7 +40,7 @@ class _HallOfFameControlState extends State { onMenuStateChange: (isOpen) => _isOpen = isOpen, customButton: Container( height: 34, - padding: EdgeInsets.fromLTRB(16, 0, 8, 0), + padding: const EdgeInsets.fromLTRB(16, 0, 8, 0), decoration: BoxDecoration( color: OTLColor.grayF, borderRadius: BorderRadius.circular(100), @@ -73,7 +73,7 @@ class _HallOfFameControlState extends State { borderRadius: BorderRadius.circular(10), color: OTLColor.gray6, ), - scrollbarTheme: ScrollbarThemeData( + scrollbarTheme: const ScrollbarThemeData( radius: Radius.circular(100), mainAxisMargin: 8.0, crossAxisMargin: 4.0, @@ -82,7 +82,7 @@ class _HallOfFameControlState extends State { ), offset: const Offset(0, -8), ), - menuItemStyleData: MenuItemStyleData( + menuItemStyleData: const MenuItemStyleData( height: 40, padding: EdgeInsets.zero, ), @@ -120,7 +120,7 @@ Widget buildItem(String text, bool selected) { Container( height: 40, alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -129,8 +129,8 @@ Widget buildItem(String text, bool selected) { style: bodyRegular.copyWith(color: OTLColor.grayF), ), selected - ? Icon(Icons.check, color: OTLColor.grayF) - : SizedBox(width: 24.0), + ? const Icon(Icons.check, color: OTLColor.grayF) + : const SizedBox(width: 24.0), ], ), ), diff --git a/lib/widgets/lecture_group_block.dart b/lib/widgets/lecture_group_block.dart index 75fbe087..0399081c 100644 --- a/lib/widgets/lecture_group_block.dart +++ b/lib/widgets/lecture_group_block.dart @@ -19,20 +19,20 @@ class LectureGroupBlock extends StatelessWidget { borderRadius: BorderRadius.circular(4.0), color: OTLColor.grayE, ), - child: Text("There is no lecture."), + child: const Text("There is no lecture."), ); } return ClipRRect( borderRadius: BorderRadius.circular(8.0), child: ColoredBox( - color: Color(0xFFEEEEEE), + color: const Color(0xFFEEEEEE), child: Padding( - padding: EdgeInsets.fromLTRB(12, 8, 12, 8), + padding: const EdgeInsets.fromLTRB(12, 8, 12, 8), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( - padding: EdgeInsets.only(bottom: 4.0), + padding: const EdgeInsets.only(bottom: 4.0), child: Wrap( alignment: WrapAlignment.spaceBetween, crossAxisAlignment: WrapCrossAlignment.center, @@ -45,7 +45,7 @@ class LectureGroupBlock extends StatelessWidget { style: const TextStyle( fontSize: 14.0, fontWeight: FontWeight.bold), ), - SizedBox( + const SizedBox( width: 4, ), Text( @@ -72,7 +72,7 @@ class LectureGroupBlock extends StatelessWidget { ], ), ), - Padding( + const Padding( padding: EdgeInsets.symmetric(vertical: 4.0), child: SizedBox( height: 1, diff --git a/lib/widgets/lecture_group_block_row.dart b/lib/widgets/lecture_group_block_row.dart index 8b15a20a..81acd7d6 100644 --- a/lib/widgets/lecture_group_block_row.dart +++ b/lib/widgets/lecture_group_block_row.dart @@ -65,16 +65,16 @@ class _LectureGroupBlockRowState extends State { Text.rich(TextSpan(children: [ TextSpan( text: widget.lecture.classTitle, - style: TextStyle( + style: const TextStyle( fontSize: 14.0, fontWeight: FontWeight.bold)), - WidgetSpan( + const WidgetSpan( child: SizedBox( width: 8, ), ), WidgetSpan( child: Text(widget.lecture.professorsStrShort, - style: TextStyle( + style: const TextStyle( fontSize: 14.0, color: Colors.black54))) ])) ], @@ -82,7 +82,7 @@ class _LectureGroupBlockRowState extends State { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), + padding: const EdgeInsets.symmetric(horizontal: 8.0), child: SizedBox( width: 50, child: Visibility( @@ -95,9 +95,9 @@ class _LectureGroupBlockRowState extends State { icon: 'assets/icons/info.svg', iconSize: 20.0, onTap: widget.onLongPress, - color: Color(0xFF000000), + color: const Color(0xFF000000), ), - SizedBox( + const SizedBox( width: 6.0, ), IconTextButton( @@ -114,7 +114,7 @@ class _LectureGroupBlockRowState extends State { iconSize: 24, color: alreadyAdded ? OTLColor.pinksMain - : Color(0xFF000000), + : const Color(0xFF000000), ) ], ), @@ -143,7 +143,7 @@ class _LectureGroupBlockRowState extends State { "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?"), actions: [ IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.cancel'.tr(), color: OTLColor.pinksMain, onTap: () { @@ -152,7 +152,7 @@ class _LectureGroupBlockRowState extends State { }, ), IconTextButton( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), text: 'common.add'.tr(), color: OTLColor.pinksMain, onTap: () { diff --git a/lib/widgets/lecture_group_simple_block.dart b/lib/widgets/lecture_group_simple_block.dart index 22930631..7501bf21 100644 --- a/lib/widgets/lecture_group_simple_block.dart +++ b/lib/widgets/lecture_group_simple_block.dart @@ -19,7 +19,8 @@ class LectureGroupSimpleBlock extends StatelessWidget { @override Widget build(BuildContext context) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Column( children: [ @@ -78,7 +79,7 @@ class LectureGroupSimpleBlock extends StatelessWidget { text: lecture.classTitle, style: evenBodyBold, ), - TextSpan(text: ' '), + const TextSpan(text: ' '), TextSpan( text: isEn ? lecture.professorsStrShortEn diff --git a/lib/widgets/lecture_search.dart b/lib/widgets/lecture_search.dart index c15e7a54..e9c8712c 100644 --- a/lib/widgets/lecture_search.dart +++ b/lib/widgets/lecture_search.dart @@ -41,15 +41,16 @@ class _LectureSearchState extends State { child: Padding( padding: const EdgeInsets.fromLTRB(16, 12, 0, 12), child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(8.0)), + borderRadius: + const BorderRadius.all(Radius.circular(8.0)), child: BackgroundButton( onTap: () => Navigator.of(context).push( MaterialPageRoute( - builder: (context) => - LectureSearchPage(openKeyboard: false))), - color: Color(0xFFF9F0F0), + builder: (context) => const LectureSearchPage( + openKeyboard: false))), + color: const Color(0xFFF9F0F0), child: Padding( - padding: EdgeInsets.all(8.0), + padding: const EdgeInsets.all(8.0), child: SizedBox( height: 20, child: Row( @@ -59,9 +60,9 @@ class _LectureSearchState extends State { SvgPicture.asset('assets/icons/search.svg', height: 24.0, width: 24.0, - colorFilter: ColorFilter.mode( + colorFilter: const ColorFilter.mode( OTLColor.pinksMain, BlendMode.srcIn)), - SizedBox(width: 12.0), + const SizedBox(width: 12.0), Flexible( child: context .watch() @@ -73,7 +74,7 @@ class _LectureSearchState extends State { )), )), IconTextButton( - padding: EdgeInsets.fromLTRB(8, 12, 16, 12), + padding: const EdgeInsets.fromLTRB(8, 12, 16, 12), icon: Icons.close_outlined, iconSize: 24, onTap: widget.onClosed, @@ -82,8 +83,8 @@ class _LectureSearchState extends State { ), Expanded( child: searchModel.isSearching - ? Center( - child: const CircularProgressIndicator(), + ? const Center( + child: CircularProgressIndicator(), ) : Scrollbar( controller: _scrollController, @@ -100,7 +101,7 @@ class _LectureSearchState extends State { ListView _buildListView( List> lectures, ScrollController scrollController) { return ListView.separated( - padding: EdgeInsets.fromLTRB(16, 0, 16, 12), + padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), controller: scrollController, itemCount: lectures.length, itemBuilder: (context, index) => LectureGroupBlock( @@ -112,6 +113,6 @@ class _LectureSearchState extends State { Navigator.push(context, buildLectureDetailPageRoute()); }, ), - separatorBuilder: (context, index) => SizedBox(height: 8)); + separatorBuilder: (context, index) => const SizedBox(height: 8)); } } diff --git a/lib/widgets/lecture_simple_block.dart b/lib/widgets/lecture_simple_block.dart index acb53e49..c4947f7b 100644 --- a/lib/widgets/lecture_simple_block.dart +++ b/lib/widgets/lecture_simple_block.dart @@ -15,7 +15,8 @@ class LectureSimpleBlock extends StatelessWidget { @override Widget build(BuildContext context) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Container( margin: const EdgeInsets.all(3.0), diff --git a/lib/widgets/map_view.dart b/lib/widgets/map_view.dart index 4a719ce1..8ff1f875 100644 --- a/lib/widgets/map_view.dart +++ b/lib/widgets/map_view.dart @@ -90,7 +90,7 @@ class _MapViewState extends State { _width = MediaQuery.of(context).size.width - 100; _height = _width * 131 / 146; - _isKo = context.locale == Locale('ko'); + _isKo = context.locale == const Locale('ko'); return CustomScrollView( slivers: [ @@ -99,7 +99,7 @@ class _MapViewState extends State { delegate: CustomHeaderDelegate( widget: Container( height: _height + 12, - padding: EdgeInsets.fromLTRB(50, 0, 50, 12), + padding: const EdgeInsets.fromLTRB(50, 0, 50, 12), color: OTLColor.grayF, child: Stack( clipBehavior: Clip.none, @@ -131,7 +131,7 @@ class _MapViewState extends State { BoxShadow( color: OTLColor.gray0.withOpacity(0.25), blurRadius: 4, - offset: Offset(0, 4), + offset: const Offset(0, 4), ) ]; return Positioned( diff --git a/lib/widgets/pop_up.dart b/lib/widgets/pop_up.dart index 102dba3e..546a4aeb 100644 --- a/lib/widgets/pop_up.dart +++ b/lib/widgets/pop_up.dart @@ -20,13 +20,13 @@ class _PopUpState extends State { Widget build(BuildContext context) { return AlertDialog( backgroundColor: Colors.transparent, - contentPadding: EdgeInsets.all(0.0), - actionsPadding: EdgeInsets.only(top: 8.0), + contentPadding: const EdgeInsets.all(0.0), + actionsPadding: const EdgeInsets.only(top: 8.0), elevation: 0.0, content: _buildAppEvent(context), actions: [ Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(16.0), @@ -72,7 +72,8 @@ class _PopUpState extends State { } Widget _buildAppEvent(BuildContext context) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return SingleChildScrollView( child: Container( @@ -100,7 +101,7 @@ Widget _buildAppEvent(BuildContext context) { children: [ Text('popup.join_the_event'.tr(), style: bodyBold), const SizedBox(width: 8.0), - Icon(Icons.arrow_forward) + const Icon(Icons.arrow_forward) ], ), ), @@ -121,9 +122,9 @@ Widget _buildGraduatePlanner() { TextSpan( style: titleBold, children: [ - TextSpan(text: '졸업플래너'), + const TextSpan(text: '졸업플래너'), TextSpan(style: labelBold, text: 'BETA'), - TextSpan(text: ' 서비스 이용 안내'), + const TextSpan(text: ' 서비스 이용 안내'), ], ), textAlign: TextAlign.center, @@ -144,9 +145,9 @@ Widget _buildGraduatePlanner() { TextSpan( style: titleBold, children: [ - TextSpan(text: '졸업플래너'), + const TextSpan(text: '졸업플래너'), TextSpan(style: labelBold, text: 'BETA'), - TextSpan(text: ' 이용하러 가기'), + const TextSpan(text: ' 이용하러 가기'), ], ), textAlign: TextAlign.center, diff --git a/lib/widgets/review_block.dart b/lib/widgets/review_block.dart index fb28e6c1..988c36f7 100644 --- a/lib/widgets/review_block.dart +++ b/lib/widgets/review_block.dart @@ -34,7 +34,8 @@ class _ReviewBlockState extends State { @override Widget build(BuildContext context) { String content = widget.review.content; - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Padding( padding: const EdgeInsets.only(bottom: 8.0), @@ -144,7 +145,7 @@ class _ReviewBlockState extends State { spaceBetween: 4.0, text: "review.like".tr(), textStyle: labelRegular, - padding: EdgeInsets.fromLTRB(3, 8, 10, 8), + padding: const EdgeInsets.fromLTRB(3, 8, 10, 8), onTap: _liked ? _uploadCancel : _uploadLike, ), IconTextButton( @@ -152,7 +153,7 @@ class _ReviewBlockState extends State { text: "review.report".tr(), textStyle: labelRegular, onTap: _report, - padding: EdgeInsets.fromLTRB(3, 8, 10, 8), + padding: const EdgeInsets.fromLTRB(3, 8, 10, 8), ) ], ) @@ -188,12 +189,12 @@ class _ReviewBlockState extends State { showDialog( context: context, builder: (_) => AlertDialog( - title: Text('안내'), - content: Text( + title: const Text('안내'), + content: const Text( '이 기능은 현재 개발중입니다. 부적절한 후기는 otlplus@sparcs.org로 신고해 주세요.'), actions: [ new TextButton( - child: new Text("확인"), + child: const Text("확인"), onPressed: () { Navigator.pop(context); }, diff --git a/lib/widgets/review_mode_control.dart b/lib/widgets/review_mode_control.dart index ffe95697..a7e412e1 100644 --- a/lib/widgets/review_mode_control.dart +++ b/lib/widgets/review_mode_control.dart @@ -20,7 +20,7 @@ class _ReviewModeControlState extends State { Widget build(BuildContext context) { return Container( padding: const EdgeInsets.fromLTRB(16, 4, 4, 4), - decoration: BoxDecoration( + decoration: const BoxDecoration( color: OTLColor.grayF, borderRadius: BorderRadius.horizontal(right: Radius.circular(21)), ), @@ -34,9 +34,10 @@ class _ReviewModeControlState extends State { child: Container( height: 34, width: widget._selectedMode == 1 ? 48 : 0, - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12), + padding: + const EdgeInsets.symmetric(vertical: 4, horizontal: 12), child: widget._selectedMode == 1 - ? Icon( + ? const Icon( Icons.emoji_events_outlined, color: OTLColor.pinksMain, ) @@ -49,7 +50,7 @@ class _ReviewModeControlState extends State { color: OTLColor.grayF, borderRadius: BorderRadius.circular(17), ), - padding: EdgeInsets.only(left: 12.0, right: 16.0), + padding: const EdgeInsets.only(left: 12.0, right: 16.0), child: Row( children: [ Icon( @@ -74,9 +75,10 @@ class _ReviewModeControlState extends State { child: Container( height: 34, width: widget._selectedMode == 0 ? 48 : 0, - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12), + padding: + const EdgeInsets.symmetric(vertical: 4, horizontal: 12), child: widget._selectedMode == 0 - ? Icon( + ? const Icon( Icons.whatshot_outlined, color: OTLColor.pinksMain, ) @@ -87,7 +89,7 @@ class _ReviewModeControlState extends State { ), AnimatedPositioned( left: 48.0 * widget._selectedMode, - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, child: Container( height: 34, @@ -95,7 +97,7 @@ class _ReviewModeControlState extends State { color: OTLColor.pinksMain, borderRadius: BorderRadius.circular(17), ), - padding: EdgeInsets.only(left: 12.0, right: 16.0), + padding: const EdgeInsets.only(left: 12.0, right: 16.0), child: Row( children: [ Icon( diff --git a/lib/widgets/review_write_block.dart b/lib/widgets/review_write_block.dart index b74350f6..96c0ac5b 100644 --- a/lib/widgets/review_write_block.dart +++ b/lib/widgets/review_write_block.dart @@ -55,7 +55,8 @@ class _ReviewWriteBlockState extends State { @override Widget build(BuildContext context) { - final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + final isEn = + EasyLocalization.of(context)?.currentLocale == const Locale('en'); return Container( margin: const EdgeInsets.only(bottom: 8.0), diff --git a/lib/widgets/search_filter_panel.dart b/lib/widgets/search_filter_panel.dart index 48ecfb10..92cbd986 100644 --- a/lib/widgets/search_filter_panel.dart +++ b/lib/widgets/search_filter_panel.dart @@ -39,10 +39,10 @@ class _SearchFilterPanelState extends State { controller: _scrollController, itemCount: widget.filter.entries.length, shrinkWrap: true, - padding: EdgeInsets.all(16.0), + padding: const EdgeInsets.all(16.0), itemBuilder: (context, index) { return Padding( - padding: EdgeInsets.only(bottom: 24.0), + padding: const EdgeInsets.only(bottom: 24.0), child: Selector( title: widget.filter.values.elementAt(index).label, selectList: widget.filter.values.elementAt(index).options, @@ -56,7 +56,7 @@ class _SearchFilterPanelState extends State { ), ); }, - separatorBuilder: (context, index) => SizedBox(height: 8)), + separatorBuilder: (context, index) => const SizedBox(height: 8)), ), ), ); @@ -90,7 +90,7 @@ class _SelectorState extends State { child: Column( children: [ Padding( - padding: EdgeInsets.only(bottom: 12.0), + padding: const EdgeInsets.only(bottom: 12.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -101,7 +101,7 @@ class _SelectorState extends State { widget.title, style: titleBold, ), - SizedBox(width: 8), + const SizedBox(width: 8), Visibility( visible: widget.isMultiSelect, child: Text.rich( @@ -207,7 +207,7 @@ class _RadioSelectionState extends State { (i) => Expanded( child: i < v.length ? Padding( - padding: EdgeInsets.all(4.0), + padding: const EdgeInsets.all(4.0), child: RadioSelectButton( option: v[i], setOption: (b) { @@ -220,7 +220,7 @@ class _RadioSelectionState extends State { }, ), ) - : SizedBox(), + : const SizedBox(), ), ), ); @@ -253,7 +253,7 @@ class _RadioSelectButtonState extends State { child: SizedBox( height: 32.0, child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), + padding: const EdgeInsets.symmetric(horizontal: 8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -266,8 +266,8 @@ class _RadioSelectButtonState extends State { ), ), widget.option.selected - ? Icon(Icons.check, size: 16.0, color: OTLColor.gray0) - : Icon(Icons.add, size: 16.0, color: OTLColor.grayA) + ? const Icon(Icons.check, size: 16.0, color: OTLColor.gray0) + : const Icon(Icons.add, size: 16.0, color: OTLColor.grayA) ], ), ), @@ -305,7 +305,7 @@ class _SilderSelectionState extends State { double _value = 0; - TextStyle labelTextStyle = TextStyle( + TextStyle labelTextStyle = const TextStyle( fontSize: 12, ); @override @@ -322,7 +322,7 @@ class _SilderSelectionState extends State { Widget build(BuildContext context) { final divisions = widget.selectList.length - 1; return Padding( - padding: EdgeInsets.only(left: 2, right: 10), + padding: const EdgeInsets.only(left: 2, right: 10), child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { double leftPadding = _textWidth( @@ -340,13 +340,13 @@ class _SilderSelectionState extends State { left: leftPadding - 8, right: rightPadding - 8), child: SliderTheme( data: SliderThemeData( - thumbShape: CustomSliderThumbShape( + thumbShape: const CustomSliderThumbShape( outerThumbRadius: 10, innerThumbRadius: 7, outerThumbColor: Color(0xFFF6C5CD), innerThumbColor: Colors.white), trackHeight: 5.0, - trackShape: RoundRectangularSliderTrackShape(), + trackShape: const RoundRectangularSliderTrackShape(), tickMarkShape: SliderTickMarkShape.noTickMark, overlayShape: SliderComponentShape.noThumb), child: Slider( @@ -354,8 +354,8 @@ class _SilderSelectionState extends State { min: 0.0, max: divisions.toDouble(), divisions: divisions, - activeColor: Color(0xFFF6C5CD), - inactiveColor: Color(0xFFEEEEEE), + activeColor: const Color(0xFFF6C5CD), + inactiveColor: const Color(0xFFEEEEEE), onChanged: (double value) { setState(() { _value = value; diff --git a/lib/widgets/search_textfield.dart b/lib/widgets/search_textfield.dart index f221b697..9d0184c5 100644 --- a/lib/widgets/search_textfield.dart +++ b/lib/widgets/search_textfield.dart @@ -29,14 +29,14 @@ class _SearchTextfieldState extends State { color: OTLColor.grayF, borderRadius: BorderRadius.circular(8.0), ), - padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Row( children: [ SvgPicture.asset('assets/icons/search.svg', height: 24.0, width: 24.0, colorFilter: - ColorFilter.mode(OTLColor.pinksMain, BlendMode.srcIn)), + const ColorFilter.mode(OTLColor.pinksMain, BlendMode.srcIn)), const SizedBox(width: 12.0), Expanded( child: TextField( diff --git a/lib/widgets/timetable.dart b/lib/widgets/timetable.dart index b4c34a5c..75141a17 100644 --- a/lib/widgets/timetable.dart +++ b/lib/widgets/timetable.dart @@ -131,7 +131,7 @@ class Timetable extends StatelessWidget { ), ), ); - return SizedBox(); + return const SizedBox(); } Widget _buildCells() { @@ -156,7 +156,7 @@ class Timetable extends StatelessWidget { padding: const EdgeInsets.only(bottom: 3), child: Text( 'timetable.days.${DAYSOFWEEK[i]}'.tr(), - style: TextStyle(fontSize: 12), + style: const TextStyle(fontSize: 12), ), ), Stack( diff --git a/lib/widgets/timetable_block.dart b/lib/widgets/timetable_block.dart index 964f068b..914733d6 100644 --- a/lib/widgets/timetable_block.dart +++ b/lib/widgets/timetable_block.dart @@ -42,7 +42,7 @@ class TimetableBlock extends StatelessWidget { final validHeight = height - 16; final lineHeight = singleHeight(context, labelRegular); int maxLines = (validHeight - lineHeight) ~/ lineHeight; - final isKo = context.locale == Locale('ko'); + final isKo = context.locale == const Locale('ko'); final title = isKo ? lecture.title : lecture.titleEn; final classroomShort = isKo ? lecture.classtimes[classTimeIndex].classroomShort diff --git a/lib/widgets/timetable_mode_control.dart b/lib/widgets/timetable_mode_control.dart index 4886083e..d1da673a 100644 --- a/lib/widgets/timetable_mode_control.dart +++ b/lib/widgets/timetable_mode_control.dart @@ -26,7 +26,7 @@ class _TimetableModeControlState extends State { width: 164, height: 40, padding: const EdgeInsets.fromLTRB(4, 4, 16, 4), - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.horizontal(left: Radius.circular(20)), ), @@ -34,7 +34,7 @@ class _TimetableModeControlState extends State { children: [ AnimatedPositioned( left: 48.0 * widget.dropdownIndex, - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, child: Container( width: 48, @@ -55,7 +55,8 @@ class _TimetableModeControlState extends State { behavior: HitTestBehavior.opaque, child: Container( height: 32, - padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12), + padding: + const EdgeInsets.symmetric(vertical: 4, horizontal: 12), child: Icon( _iconList[index], color: (index == widget.dropdownIndex) diff --git a/lib/widgets/timetable_summary.dart b/lib/widgets/timetable_summary.dart index d05e6826..0a4fda62 100644 --- a/lib/widgets/timetable_summary.dart +++ b/lib/widgets/timetable_summary.dart @@ -117,7 +117,7 @@ class TimetableSummary extends StatelessWidget { return Container( height: 75, padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 16), - decoration: BoxDecoration( + decoration: const BoxDecoration( border: Border.symmetric( horizontal: BorderSide(color: OTLColor.pinksLight)), ), @@ -130,7 +130,7 @@ class TimetableSummary extends StatelessWidget { itemCount: 6, scrollDirection: Axis.horizontal, physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 6, mainAxisExtent: 45, diff --git a/lib/widgets/timetable_tabs.dart b/lib/widgets/timetable_tabs.dart index 1ec83be1..ceda51ee 100644 --- a/lib/widgets/timetable_tabs.dart +++ b/lib/widgets/timetable_tabs.dart @@ -63,7 +63,7 @@ class _TimetableTabsState extends State { color: OTLColor.pinksLight, borderRadius: BorderRadius.circular(20), ), - child: Icon(Icons.add, size: 16), + child: const Icon(Icons.add, size: 16), ), ); } @@ -85,7 +85,7 @@ class _TimetableTabsState extends State { child: DropdownButton2( customButton: Container( height: 28, - padding: EdgeInsets.fromLTRB(12, 0, 8, 0), + padding: const EdgeInsets.fromLTRB(12, 0, 8, 0), decoration: BoxDecoration( color: OTLColor.pinksMain, borderRadius: BorderRadius.circular(100), @@ -94,7 +94,7 @@ class _TimetableTabsState extends State { children: [ text, const SizedBox(width: 6), - Icon( + const Icon( Icons.more_vert, color: OTLColor.grayF, size: 16, @@ -135,7 +135,7 @@ class _TimetableTabsState extends State { ), offset: const Offset(0, -8), ), - menuItemStyleData: MenuItemStyleData( + menuItemStyleData: const MenuItemStyleData( height: 40, padding: EdgeInsets.zero, ), @@ -207,7 +207,7 @@ abstract class MenuItems { Container( height: 40, alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: Row( children: [ Expanded(