This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from langx/fix-login-overflow
Refactor login page layout and add OAuth buttons
- Loading branch information
Showing
11 changed files
with
417 additions
and
112 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
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,58 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
class OAuthButton extends StatelessWidget { | ||
final String assetPath; | ||
final VoidCallback onPressed; | ||
|
||
const OAuthButton({ | ||
required this.assetPath, | ||
required this.onPressed, | ||
super.key, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Brightness platformBrightness = MediaQuery.of(context).platformBrightness; | ||
final bool isDarkMode = platformBrightness == Brightness.dark; | ||
final bool isAppleIcon = assetPath.contains('apple_icon'); | ||
|
||
return GestureDetector( | ||
onTap: onPressed, | ||
child: Container( | ||
height: 50, | ||
width: 50, | ||
decoration: BoxDecoration( | ||
color: isDarkMode ? const Color(0xFF131314) : Colors.white, | ||
borderRadius: BorderRadius.circular(4), | ||
boxShadow: const [ | ||
BoxShadow( | ||
offset: Offset(0, 1), | ||
color: Color(0x4C3C4043), | ||
blurRadius: 2, | ||
), | ||
BoxShadow( | ||
color: Color(0x26283C40), | ||
offset: Offset(0, 1), | ||
blurRadius: 3, | ||
spreadRadius: 1, | ||
), | ||
], | ||
), | ||
child: Center( | ||
child: SvgPicture.asset( | ||
assetPath, | ||
width: 25, | ||
height: 25, | ||
colorFilter: isAppleIcon | ||
? ColorFilter.mode( | ||
isDarkMode ? Colors.white : Colors.black, | ||
BlendMode.srcIn, | ||
) | ||
: null, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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
Oops, something went wrong.