This commit is contained in:
parent
6eb6f9809e
commit
511e8cda76
9 changed files with 204 additions and 40 deletions
|
@ -1,8 +1,9 @@
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:simple_git/resources/colors_schemes/lib_color_schemes.g.dart';
|
||||||
|
|
||||||
import 'page/actions_page.dart';
|
import 'page/more_page.dart';
|
||||||
import 'page/repos_page.dart';
|
import 'page/repos_page.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -34,7 +35,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
|
|
||||||
final screens = [
|
final screens = [
|
||||||
ReposPage(),
|
ReposPage(),
|
||||||
ActionPage(),
|
MorePage(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -43,6 +44,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
body: screens[_index],
|
body: screens[_index],
|
||||||
bottomNavigationBar: NavigationBarTheme(
|
bottomNavigationBar: NavigationBarTheme(
|
||||||
data: NavigationBarThemeData(
|
data: NavigationBarThemeData(
|
||||||
|
indicatorColor: darkColorScheme.primary,
|
||||||
labelTextStyle: MaterialStateProperty.all(
|
labelTextStyle: MaterialStateProperty.all(
|
||||||
const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
|
@ -50,10 +52,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
child: NavigationBar(
|
child: NavigationBar(
|
||||||
height: 70,
|
height: 70,
|
||||||
selectedIndex: _index,
|
selectedIndex: _index,
|
||||||
onDestinationSelected: (index) => setState(() => this._index = index),
|
backgroundColor: lightColorScheme.primaryContainer,
|
||||||
destinations: const [
|
onDestinationSelected: (index) => setState(() {
|
||||||
NavigationDestination(icon: Icon(Icons.home_outlined), selectedIcon: Icon(Icons.home), label: 'Repos'),
|
this._index = index;
|
||||||
NavigationDestination(icon: Icon(Icons.add_outlined), selectedIcon: Icon(Icons.add), label: 'Actions')
|
}),
|
||||||
|
destinations: [
|
||||||
|
NavigationDestination(icon: Icon(Icons.home_outlined, color: lightColorScheme.onPrimaryContainer), selectedIcon: Icon(Icons.home), label: 'Repos'),
|
||||||
|
NavigationDestination(icon: Icon(Icons.more_horiz_outlined, color: lightColorScheme.onPrimaryContainer), selectedIcon: Icon(Icons.more_horiz), label: 'More'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
21
lib/page/about_page.dart
Normal file
21
lib/page/about_page.dart
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../resources/colors_schemes/lib_color_schemes.g.dart';
|
||||||
|
|
||||||
|
class AboutPage extends StatelessWidget {
|
||||||
|
const AboutPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
color: lightColorScheme.onBackground,
|
||||||
|
),
|
||||||
|
title: Text('About', style: TextStyle(color: lightColorScheme.onPrimaryContainer)),
|
||||||
|
backgroundColor: lightColorScheme.primaryContainer,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class ActionPage extends StatelessWidget {
|
|
||||||
const ActionPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
body: Text('B'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
63
lib/page/more_page.dart
Normal file
63
lib/page/more_page.dart
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:simple_git/resources/colors_schemes/lib_color_schemes.g.dart';
|
||||||
|
|
||||||
|
import 'about_page.dart';
|
||||||
|
import 'settings_page.dart';
|
||||||
|
|
||||||
|
class MorePage extends StatefulWidget {
|
||||||
|
const MorePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MorePage> createState() => _MorePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MorePageState extends State<MorePage> {
|
||||||
|
final _texts = [
|
||||||
|
"Settings",
|
||||||
|
"About",
|
||||||
|
];
|
||||||
|
|
||||||
|
final _icons = [
|
||||||
|
Icons.settings_outlined,
|
||||||
|
Icons.info_outline,
|
||||||
|
];
|
||||||
|
|
||||||
|
final _pages = [
|
||||||
|
SettingsPage(),
|
||||||
|
AboutPage(),
|
||||||
|
];
|
||||||
|
|
||||||
|
int stateIndex = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('More',
|
||||||
|
style: TextStyle(color: lightColorScheme.onPrimaryContainer)),
|
||||||
|
backgroundColor: lightColorScheme.primaryContainer,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
body: ListView.builder(
|
||||||
|
// padding: const EdgeInsets.all(20.0),
|
||||||
|
itemCount: _texts.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ListTile(
|
||||||
|
onTap: () => selectOption(index),
|
||||||
|
title: Text(_texts[index]),
|
||||||
|
leading: Icon(_icons[index], color: lightColorScheme.primary),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectOption(index) {
|
||||||
|
stateIndex = index;
|
||||||
|
Navigator.of(context).push(PageRouteBuilder(
|
||||||
|
pageBuilder: (context, animation, secondaryAnimation) => _pages[index],
|
||||||
|
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
|
||||||
|
transitionDuration: const Duration(milliseconds: 150),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../resources/colors_schemes/lib_color_schemes.g.dart';
|
||||||
|
|
||||||
|
|
||||||
class ReposPage extends StatelessWidget {
|
class ReposPage extends StatelessWidget {
|
||||||
const ReposPage({Key? key}) : super(key: key);
|
const ReposPage({Key? key}) : super(key: key);
|
||||||
|
@ -7,7 +9,14 @@ class ReposPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Text('A'),
|
appBar: AppBar(
|
||||||
|
title: Text('Repositories', style: TextStyle(color: lightColorScheme.onPrimaryContainer)),
|
||||||
|
backgroundColor: lightColorScheme.primaryContainer,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
child: Text('A')
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
lib/page/settings_page.dart
Normal file
21
lib/page/settings_page.dart
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../resources/colors_schemes/lib_color_schemes.g.dart';
|
||||||
|
|
||||||
|
class SettingsPage extends StatelessWidget {
|
||||||
|
const SettingsPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
color: lightColorScheme.onBackground,
|
||||||
|
),
|
||||||
|
title: Text('Settings', style: TextStyle(color: lightColorScheme.onPrimaryContainer)),
|
||||||
|
backgroundColor: lightColorScheme.primaryContainer,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
65
lib/resources/colors_schemes/lib_color_schemes.g.dart
Normal file
65
lib/resources/colors_schemes/lib_color_schemes.g.dart
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
const seed = Color(0xFF3584E4);
|
||||||
|
|
||||||
|
const lightColorScheme = ColorScheme(
|
||||||
|
brightness: Brightness.light,
|
||||||
|
primary : Color(0xFF005EB5),
|
||||||
|
onPrimary : Color(0xFFFFFFFF),
|
||||||
|
primaryContainer : Color(0xFFD4E3FF),
|
||||||
|
onPrimaryContainer : Color(0xFF001B3D),
|
||||||
|
secondary : Color(0xFF555F71),
|
||||||
|
onSecondary : Color(0xFFFFFFFF),
|
||||||
|
secondaryContainer : Color(0xFFD9E3F8),
|
||||||
|
onSecondaryContainer : Color(0xFF121C2B),
|
||||||
|
tertiary : Color(0xFF6E5675),
|
||||||
|
onTertiary : Color(0xFFFFFFFF),
|
||||||
|
tertiaryContainer : Color(0xFFF8D8FE),
|
||||||
|
onTertiaryContainer : Color(0xFF27132F),
|
||||||
|
error : Color(0xFFBA1B1B),
|
||||||
|
errorContainer : Color(0xFFFFDAD4),
|
||||||
|
onError : Color(0xFFFFFFFF),
|
||||||
|
onErrorContainer : Color(0xFF410001),
|
||||||
|
background : Color(0xFFFDFBFF),
|
||||||
|
onBackground : Color(0xFF1B1B1D),
|
||||||
|
surface : Color(0xFFFDFBFF),
|
||||||
|
onSurface : Color(0xFF1B1B1D),
|
||||||
|
surfaceVariant : Color(0xFFE0E2EB),
|
||||||
|
onSurfaceVariant : Color(0xFF43474F),
|
||||||
|
outline : Color(0xFF74777F),
|
||||||
|
onInverseSurface : Color(0xFFF1F0F4),
|
||||||
|
inverseSurface : Color(0xFF2F3033),
|
||||||
|
inversePrimary : Color(0xFFA5C8FF),
|
||||||
|
shadow : Color(0xFF000000),
|
||||||
|
);
|
||||||
|
|
||||||
|
const darkColorScheme = ColorScheme(
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
primary : Color(0xFFA5C8FF),
|
||||||
|
onPrimary : Color(0xFF003063),
|
||||||
|
primaryContainer : Color(0xFF00468A),
|
||||||
|
onPrimaryContainer : Color(0xFFD4E3FF),
|
||||||
|
secondary : Color(0xFFBDC7DC),
|
||||||
|
onSecondary : Color(0xFF273141),
|
||||||
|
secondaryContainer : Color(0xFF3D4758),
|
||||||
|
onSecondaryContainer : Color(0xFFD9E3F8),
|
||||||
|
tertiary : Color(0xFFDBBDE1),
|
||||||
|
onTertiary : Color(0xFF3E2845),
|
||||||
|
tertiaryContainer : Color(0xFF553E5D),
|
||||||
|
onTertiaryContainer : Color(0xFFF8D8FE),
|
||||||
|
error : Color(0xFFFFB4A9),
|
||||||
|
errorContainer : Color(0xFF930006),
|
||||||
|
onError : Color(0xFF680003),
|
||||||
|
onErrorContainer : Color(0xFFFFDAD4),
|
||||||
|
background : Color(0xFF1B1B1D),
|
||||||
|
onBackground : Color(0xFFE3E2E6),
|
||||||
|
surface : Color(0xFF1B1B1D),
|
||||||
|
onSurface : Color(0xFFE3E2E6),
|
||||||
|
surfaceVariant : Color(0xFF43474F),
|
||||||
|
onSurfaceVariant : Color(0xFFC3C6CF),
|
||||||
|
outline : Color(0xFF8E919A),
|
||||||
|
onInverseSurface : Color(0xFF1B1B1D),
|
||||||
|
inverseSurface : Color(0xFFE3E2E6),
|
||||||
|
inversePrimary : Color(0xFF005EB5),
|
||||||
|
shadow : Color(0xFF000000),
|
||||||
|
);
|
23
pubspec.lock
23
pubspec.lock
|
@ -42,7 +42,7 @@ packages:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.16.0"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -56,7 +56,7 @@ packages:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -94,7 +94,7 @@ packages:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.3"
|
version: "0.1.4"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -108,7 +108,7 @@ packages:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.8.1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -120,7 +120,7 @@ packages:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.2"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -155,20 +155,13 @@ packages:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.8"
|
version: "0.4.9"
|
||||||
typed_data:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: typed_data
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.0"
|
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.16.2 <3.0.0"
|
dart: ">=2.17.0-0 <3.0.0"
|
||||||
|
|
|
@ -16,15 +16,15 @@ void main() {
|
||||||
await tester.pumpWidget(const MyApp());
|
await tester.pumpWidget(const MyApp());
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('Repositories'), findsOneWidget);
|
||||||
expect(find.text('B'), findsNothing);
|
expect(find.text('More'), findsOneWidget);
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
// Tap the '+' icon and trigger a frame.
|
||||||
await tester.tap(find.byIcon(Icons.add_outlined));
|
await tester.tap(find.byIcon(Icons.more_horiz_outlined));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
// Verify that our counter has incremented.
|
||||||
expect(find.text('A'), findsNothing);
|
expect(find.text('Repositories'), findsNothing);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('More'), findsWidgets);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue