Skip to content

Commit

Permalink
Change drawing_board to syncfusion_flutter_signaturepad
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkyung1234 committed May 19, 2022
1 parent 72bedb8 commit 6de6aee
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 197 deletions.
19 changes: 19 additions & 0 deletions assets/posts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"posts": [
{
"title": "고도현",
"date": "2022.02.02",
"content": "sfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawf"
},
{
"title": "Hello World",
"date": "2022.02.02",
"content": "sfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawf"
},
{
"title": "원호 hi",
"date": "2022.02.02",
"content": "sfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawfsfsdfsfwfewffsdfafawf"
}
]
}
3 changes: 0 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'pages/add_post_page.dart';
import 'pages/login/login_page.dart';
import 'pages/login/signup_page.dart';
import 'providers/signup_provider.dart';

void main() {
Expand All @@ -25,7 +23,6 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginPage(),
// home: SignupPage(),
);
}
}
126 changes: 65 additions & 61 deletions lib/pages/login/signin_page.dart
Original file line number Diff line number Diff line change
@@ -1,75 +1,79 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_drawing_board/flutter_drawing_board.dart';
import 'package:secret_diary/pages/home_page.dart';
import 'package:secret_diary/widgets/custom_button.dart';
import 'package:syncfusion_flutter_signaturepad/signaturepad.dart';

class SignInPage extends StatelessWidget {
final DrawingController _drawingController = DrawingController(
config: DrawConfig(
color: Colors.black,
paintType: PaintType.simpleLine,
thickness: 6.0,
angle: 0,
),
);
final GlobalKey<SfSignaturePadState> _signaturePadKey = GlobalKey();

@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/background2.png',
fit: BoxFit.fitHeight,
color: Colors.grey.withOpacity(0.5),
colorBlendMode: BlendMode.modulate,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Sign to Sign In',
style: TextStyle(
color: Colors.black,
fontSize: 35,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
SizedBox(
width: 350,
height: 280,
child: DrawingBoard(
controller: _drawingController,
background: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
width: 6,
color: Colors.black,
),
backgroundColor: Colors.grey,
body: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/background2.png',
fit: BoxFit.fitHeight,
color: Colors.grey.withOpacity(0.5),
colorBlendMode: BlendMode.modulate,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Sign to Sign In',
style: TextStyle(
color: Colors.black,
fontSize: 35,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
Container(
child: SfSignaturePad(
key: _signaturePadKey,
minimumStrokeWidth: 3,
maximumStrokeWidth: 3,
strokeColor: Colors.black,
backgroundColor: Colors.white,
),
height: 200,
width: 300,
decoration: BoxDecoration(
border: Border.all(
width: 6,
color: Colors.black,
),
),
),
),
const SizedBox(height: 50),
CustomButton(
text: '로그인',
backgroundColor: Colors.white,
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage(),
),
);
},
),
],
),
],
));
const SizedBox(height: 50),
CustomButton(
text: '로그인',
backgroundColor: Colors.white,
onPressed: () async {
// final data = await _signaturePadKey.currentState!
// .toImage(pixelRatio: 3.0);
// final bytes =
// await data.toByteData(format: ImageByteFormat.png);
// final image = bytes!.buffer.asUint8List();

Navigator.pop(context);
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage(),
),
);
},
),
],
),
],
),
);
}
}
Loading

0 comments on commit 6de6aee

Please sign in to comment.