Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
a5e04e48
Commit
a5e04e48
authored
May 17, 2023
by
netyouli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创作添加编辑历史记录存储
parent
53120056
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
448 additions
and
328 deletions
+448
-328
ios/Podfile.lock
ios/Podfile.lock
+6
-6
lib/common/db/db_tool.dart
lib/common/db/db_tool.dart
+69
-0
lib/pages/creation-detail/controller.dart
lib/pages/creation-detail/controller.dart
+19
-4
lib/pages/creation-detail/models/detail_model.dart
lib/pages/creation-detail/models/detail_model.dart
+32
-0
pubspec.lock
pubspec.lock
+318
-318
windows/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugin_registrant.cc
+3
-0
windows/flutter/generated_plugins.cmake
windows/flutter/generated_plugins.cmake
+1
-0
No files found.
ios/Podfile.lock
View file @
a5e04e48
...
...
@@ -47,11 +47,11 @@ PODS:
- FirebaseAuth (~> 10.7.0)
- Firebase/CoreOnly (10.7.0):
- FirebaseCore (= 10.7.0)
- firebase_auth (4.
4.1
):
- firebase_auth (4.
6.0
):
- Firebase/Auth (= 10.7.0)
- firebase_core
- Flutter
- firebase_core (2.
9
.0):
- firebase_core (2.
12
.0):
- Firebase/CoreOnly (= 10.7.0)
- Flutter
- FirebaseAuth (10.7.0):
...
...
@@ -289,8 +289,8 @@ SPEC CHECKSUMS:
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Firebase: 0219acf760880eeec8ce479895bd7767466d9f81
firebase_auth:
5a84572b7f5315a3aff5b07c62bb0cd5a28cad
e5
firebase_core:
d85432877e814811e040e7659f9c82faeab66e04
firebase_auth:
6608b43809305e8d82957dffd6419b04ee4a31
e5
firebase_core:
312d0d81b346ec20540822c8498e626d6918ef48
FirebaseAuth: dd64c01631df724b09f33e584625775c52f7d71f
FirebaseCore: e317665b9d744727a97e623edbbed009320afdd7
FirebaseCoreInternal: 8845798510aae74703467480f71ac613788d0696
...
...
@@ -313,12 +313,12 @@ SPEC CHECKSUMS:
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider_foundation:
c68054786f1b4f3343858c1e1d0caaded73f0be9
path_provider_foundation:
eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation:
986fc17f3d3251412d18b0265f9c64113a8c2472
shared_preferences_foundation:
e2dae3258e06f44cc55f49d42024fd8dd03c590c
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
...
...
lib/common/db/db_tool.dart
0 → 100644
View file @
a5e04e48
import
'package:sqflite/sqflite.dart'
;
class
DBTableName
{
static
const
makeDetails
=
"make_details"
;
}
class
DBModel
{
final
createTableSql
=
""
;
final
tableName
=
""
;
final
mapValues
=
Map
<
String
,
Object
>();
}
class
DBTool
{
static
Database
?
_db
;
static
const
int
_version
=
1
;
static
const
String
_dbName
=
'database'
;
static
Future
<
void
>
_initDB
(
DBModel
model
)
async
{
if
(
_db
!=
null
)
{
return
;
}
final
basePath
=
await
getDatabasesPath
();
final
path
=
'
$basePath$_dbName
.db'
;
_db
=
await
openDatabase
(
path
,
version:
_version
);
}
static
Future
<
bool
>
_isExistTable
(
String
tableName
)
async
{
//内建表sqlite_master
var
sql
=
"SELECT * FROM sqlite_master WHERE TYPE = 'table' AND NAME = '
$tableName
'"
;
var
res
=
await
_db
?.
rawQuery
(
sql
);
var
isExist
=
res
!=
null
&&
res
.
isNotEmpty
;
return
isExist
;
}
static
Future
<
void
>
_createTable
(
DBModel
model
)
async
{
await
_initDB
(
model
);
var
isExist
=
await
_isExistTable
(
model
.
tableName
);
if
(!
isExist
)
{
await
_db
?.
execute
(
model
.
createTableSql
);
}
}
static
Future
<
int
>
insert
(
DBModel
model
)
async
{
await
_createTable
(
model
);
return
await
_db
?.
insert
(
model
.
tableName
,
model
.
mapValues
)
??
0
;
}
static
Future
<
int
>
update
(
DBModel
model
,
{
String
?
where
,
bool
?
isInsert
=
false
})
async
{
await
_createTable
(
model
);
if
(
isInsert
??
false
)
{
final
list
=
await
query
(
model
.
tableName
,
where:
where
);
if
(
list
.
isEmpty
)
{
return
await
insert
(
model
);
}
}
return
await
_db
?.
update
(
model
.
tableName
,
model
.
mapValues
,
where:
where
)
??
0
;
}
static
Future
<
List
<
Map
<
String
,
Object
?>>>
query
(
String
tableName
,
{
String
?
where
})
async
{
return
await
_db
?.
query
(
tableName
,
where:
where
)
??
[];
}
static
Future
<
int
>
delete
(
DBModel
model
,
{
String
?
where
})
async
{
await
_createTable
(
model
);
return
await
_db
?.
delete
(
model
.
tableName
,
where:
where
)
??
0
;
}
}
lib/pages/creation-detail/controller.dart
View file @
a5e04e48
...
...
@@ -5,11 +5,14 @@ import 'package:chart/common/entities/detail.dart';
import
'package:chart/common/routers/names.dart'
;
import
'package:chart/common/store/user.dart'
;
import
'package:chart/common/values/server.dart'
;
import
'package:chart/pages/creation-detail/models/detail_model.dart'
;
import
'package:clipboard/clipboard.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_client_sse/flutter_client_sse.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:get/get.dart'
;
import
'package:highlight/languages/awk.dart'
;
import
'../../../common/db/db_tool.dart'
;
import
'index.dart'
;
...
...
@@ -24,6 +27,7 @@ class CreationDetailController extends GetxController {
'input2'
:
TextEditingController
(),
};
final
state
=
CreationDetailState
();
final
model
=
DetailModel
();
// final
...
...
@@ -35,15 +39,21 @@ class CreationDetailController extends GetxController {
);
}
getController
(
int
key
)
{
return
inputControllerMap
[
'input
$key
'
];
TextEditingController
getController
(
int
key
)
{
return
inputControllerMap
[
'input
$key
'
]
!
;
}
void
updateState
(
String
id
,
String
title
,
List
<
DetailData
>
items
)
{
void
updateState
(
String
id
,
String
title
,
List
<
DetailData
>
items
)
async
{
state
.
title
=
title
;
state
.
id
=
id
;
// state.detailList.value = [];
final
list
=
await
DBTool
.
query
(
DetailModel
.
TableName
,
where:
"type = '
$title
'"
);
if
(
list
.
isNotEmpty
)
{
final
model
=
DetailModel
.
fromJson
(
list
[
0
]);
inputControllerMap
[
"input1"
]?.
text
=
model
.
object
;
inputControllerMap
[
"input2"
]?.
text
=
model
.
subject
;
// state.genText = model.content;
}
items
.
sort
((
a
,
b
)
=>
a
.
sort
!
-
b
.
sort
!);
// input1
state
.
detailList
.
addAll
(
items
);
...
...
@@ -122,6 +132,11 @@ class CreationDetailController extends GetxController {
}
bool
back
()
{
model
.
type
=
to
.
state
.
title
;
model
.
object
=
inputControllerMap
[
"input1"
]?.
text
??
""
;
model
.
subject
=
inputControllerMap
[
"input2"
]?.
text
??
""
;
model
.
content
=
state
.
genText
;
DBTool
.
update
(
model
,
isInsert:
true
,
where:
"type = '
${model.type}
'"
);
state
.
detailList
.
value
=
[];
inputControllerMap
[
'input1'
]!.
text
=
''
;
inputControllerMap
[
'input2'
]!.
text
=
''
;
...
...
lib/pages/creation-detail/models/detail_model.dart
0 → 100644
View file @
a5e04e48
import
'../../../common/db/db_tool.dart'
;
class
DetailModel
implements
DBModel
{
static
const
TableName
=
"DetailModel"
;
var
type
=
""
;
var
object
=
""
;
var
subject
=
""
;
var
content
=
""
;
@override
// TODO: implement tableName
String
get
tableName
=>
TableName
;
@override
// TODO: implement createTableSql
String
get
createTableSql
=>
"CREATE TABLE
$tableName
(id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT, object TEXT, subject TEXT, content TEXT)"
;
@override
// TODO: implement mapValues
Map
<
String
,
Object
>
get
mapValues
=>
{
"type"
:
type
,
"object"
:
object
,
"subject"
:
subject
,
"content"
:
content
};
static
DetailModel
fromJson
(
Map
<
String
,
Object
?>
jsonData
)
{
final
model
=
DetailModel
();
model
.
content
=
jsonData
[
"content"
]
as
String
;
model
.
type
=
jsonData
[
"type"
]
as
String
;
model
.
object
=
jsonData
[
"object"
]
as
String
;
model
.
subject
=
jsonData
[
"subject"
]
as
String
;
return
model
;
}
}
\ No newline at end of file
pubspec.lock
View file @
a5e04e48
This diff is collapsed.
Click to expand it.
windows/flutter/generated_plugin_registrant.cc
View file @
a5e04e48
...
...
@@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <firebase_core/firebase_core_plugin_c_api.h>
#include <flutter_tts/flutter_tts_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <smart_auth/smart_auth_plugin.h>
...
...
@@ -15,6 +16,8 @@
void
RegisterPlugins
(
flutter
::
PluginRegistry
*
registry
)
{
ConnectivityPlusWindowsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"ConnectivityPlusWindowsPlugin"
));
FirebaseCorePluginCApiRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FirebaseCorePluginCApi"
));
FlutterTtsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FlutterTtsPlugin"
));
SharePlusWindowsPluginCApiRegisterWithRegistrar
(
...
...
windows/flutter/generated_plugins.cmake
View file @
a5e04e48
...
...
@@ -4,6 +4,7 @@
list
(
APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
firebase_core
flutter_tts
share_plus
smart_auth
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment